From: Minfei Huang <mnghuan@gmail.com>
To: mingo@redhat.com, peterz@infradead.org
Cc: linux-kernel@vger.kernel.org, Minfei Huang <mnghuan@gmail.com>
Subject: [PATCH] Remove useless test during exchanging values
Date: Thu, 21 Apr 2016 20:28:28 +0800 [thread overview]
Message-ID: <1461241708-812-1-git-send-email-mnghuan@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2016-04-21 12:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 12:28 Minfei Huang [this message]
2016-04-21 13:27 ` [PATCH] Remove useless test during exchanging values Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461241708-812-1-git-send-email-mnghuan@gmail.com \
--to=mnghuan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox