From: Boqun Feng <boqun.feng@gmail.com>
To: Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>
Subject: [PATCH] sched/fair: code clean up for __sched_period()
Date: Thu, 2 Jul 2015 22:25:52 +0800 [thread overview]
Message-ID: <1435847152-29543-1-git-send-email-boqun.feng@gmail.com> (raw)
Since commit: 4bf0b77158 ("sched: remove do_div() from
__sched_slice()"), the logic of __sched_period() can be implemented as a
single if-else without any local variable, so this patch cleans it up
with an if-else statement, which expresses the function's logic
straightforwardly.
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
kernel/sched/fair.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4b6e5f6..341a51f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -616,15 +616,10 @@ static inline u64 calc_delta_fair(u64 delta, struct sched_entity *se)
*/
static u64 __sched_period(unsigned long nr_running)
{
- u64 period = sysctl_sched_latency;
- unsigned long nr_latency = sched_nr_latency;
-
- if (unlikely(nr_running > nr_latency)) {
- period = sysctl_sched_min_granularity;
- period *= nr_running;
- }
-
- return period;
+ if (unlikely(nr_running > sched_nr_latency))
+ return nr_running * sysctl_sched_min_granularity;
+ else
+ return sysctl_sched_latency;
}
/*
--
2.4.5
next reply other threads:[~2015-07-02 14:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 14:25 Boqun Feng [this message]
2015-07-06 12:41 ` Boqun Feng
2015-07-06 12:49 ` Peter Zijlstra
2015-07-06 12:53 ` Ingo Molnar
2015-07-06 13:47 ` Boqun Feng
2015-07-06 13:37 ` Boqun Feng
2015-07-06 15:51 ` [tip:sched/core] sched/fair: Clean up the __sched_period() code tip-bot for Boqun Feng
2015-07-07 6:49 ` tip-bot for Boqun Feng
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=1435847152-29543-1-git-send-email-boqun.feng@gmail.com \
--to=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
/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
all inboxes | Powered by JetHome®