From b2e60dbe086b878dfb9a01ece93c2352e6bf8747 Mon Sep 17 00:00:00 2001 From: Joonwoo Park Date: Mon, 24 Aug 2015 15:14:44 -0700 Subject: [PATCH] sched: avoid unnecessary multiplication and division Avoid unnecessary multiplication and division when load scaling factor is 1024. Change-Id: If3cb63a77feaf49cc69ddec7f41cc3c1cabbfc5a Signed-off-by: Joonwoo Park --- kernel/sched/sched.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index fa04d61ad70a..183dca8f05d8 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1034,8 +1034,10 @@ static inline u64 scale_load_to_cpu(u64 task_load, int cpu) { struct rq *rq = cpu_rq(cpu); - task_load *= (u64)rq->load_scale_factor; - task_load /= 1024; + if (rq->load_scale_factor != 1024) { + task_load *= (u64)rq->load_scale_factor; + task_load /= 1024; + } return task_load; }