sched/fair: code clean up for __sched_period()
PATCH 1/1 sched/fair: code clean up for __sched_period()
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.
--- kernel/sched/fair.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
kernel/sched/fair.c +4 -9
@@ -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; }/*
Signature · 1 line
2.4.5
Ping. Any idea on this one?
Quoted 7 lines · Boqun Feng
Since commit:
4bf0b77158("sched: removedo_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 <[email protected]>
<...>
Thanks,
Boqun
Peter Zijlstra
maintainerQuoted 1 line · Boqun Feng
Ping. Any idea on this one?
I think I queued this one.
Quoted 4 lines · Peter Zijlstra
Quoted 1 line · Boqun Feng
Ping. Any idea on this one?
I think I queued this one.
Yeah, and I applied it from you earlier today - it's still being a tested, will push it out later today.
Thanks,
Ingo
Hi Ingo,
Quoted 11 lines · Ingo Molnar
Quoted 4 lines · Peter Zijlstra
Quoted 1 line · Boqun Feng
Ping. Any idea on this one?
I think I queued this one.
Yeah, and I applied it from you earlier today - it's still being a tested, will push it out later today.
Clearly, I'm not very familiar with the patch processing flow for scheduler.. sorry about that. Much clear now, Thank you!
Regards,
Boqun
Hi Peter,
Quoted 4 lines · Peter Zijlstra
Quoted 1 line · Boqun Feng
Ping. Any idea on this one?
I think I queued this one.
Sorry, I only had looked up in the "tip" tree.. just found it on your tree. Thank you!
Regards,
Boqun
tip-bot for Boqun Feng
merge bot[tip:sched/core] sched/fair: Clean up the __sched_period() code
In reply to Boqun Fengsched/fair: Clean up the __sched_period() code
Commit-ID: 42d1c60e15ff89150a3b3537fec579f8a8f36a8a Gitweb: http://git.kernel.org/tip/42d1c60e15ff89150a3b3537fec579f8a8f36a8a Author: Boqun Feng <[email protected]> AuthorDate: Thu, 2 Jul 2015 22:25:52 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 6 Jul 2015 15:29:56 +0200
sched/fair: Clean up the __sched_period() code
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 variables, so this patch cleans it up with an if-else statement, which expresses the function's logic straightforwardly.
--- kernel/sched/fair.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
kernel/sched/fair.c +4 -9
@@ -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; }/*
tip-bot for Boqun Feng
merge bot[tip:sched/core] sched/fair: Clean up the __sched_period() code
In reply to Boqun Fengsched/fair: Clean up the __sched_period() code
Commit-ID: 8e2b0bf397279878babcb39b021edcafe7c945eb Gitweb: http://git.kernel.org/tip/8e2b0bf397279878babcb39b021edcafe7c945eb Author: Boqun Feng <[email protected]> AuthorDate: Thu, 2 Jul 2015 22:25:52 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 7 Jul 2015 08:46:10 +0200
sched/fair: Clean up the __sched_period() code
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 variables, so this patch cleans it up with an if-else statement, which expresses the function's logic straightforwardly.
--- kernel/sched/fair.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
kernel/sched/fair.c +4 -9
@@ -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; }/*