[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1461241708-812-1-git-send-email-mnghuan@gmail.com>
Date: Thu, 21 Apr 2016 20:28:28 +0800
From: Minfei Huang <mnghuan@...il.com>
To: mingo@...hat.com, peterz@...radead.org
Cc: linux-kernel@...r.kernel.org, Minfei Huang <mnghuan@...il.com>
Subject: [PATCH] Remove useless test during exchanging values
The value delta is correct as well, although calc_load_idle[idx] is
equal to 0. Remove this useless test to improve performance, since this
function is called more frequently.
Signed-off-by: Minfei Huang <mnghuan@...il.com>
---
kernel/sched/loadavg.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index ef71590..5a5d7ae 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -216,10 +216,9 @@ void calc_load_exit_idle(void)
static long calc_load_fold_idle(void)
{
int idx = calc_load_read_idx();
- long delta = 0;
+ long delta;
- if (atomic_long_read(&calc_load_idle[idx]))
- delta = atomic_long_xchg(&calc_load_idle[idx], 0);
+ delta = atomic_long_xchg(&calc_load_idle[idx], 0);
return delta;
}
--
2.6.3
Powered by blists - more mailing lists