public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: code clean up for __sched_period()
@ 2015-07-02 14:25 Boqun Feng
  2015-07-06 12:41 ` Boqun Feng
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Boqun Feng @ 2015-07-02 14:25 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel, Srikar Dronamraju, Boqun Feng

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] sched/fair: code clean up for __sched_period()
  2015-07-02 14:25 [PATCH] sched/fair: code clean up for __sched_period() Boqun Feng
@ 2015-07-06 12:41 ` Boqun Feng
  2015-07-06 12:49   ` Peter Zijlstra
  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
  2 siblings, 1 reply; 8+ messages in thread
From: Boqun Feng @ 2015-07-06 12:41 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel, Srikar Dronamraju

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

Ping. Any idea on this one?

On Thu, Jul 02, 2015 at 10:25:52PM +0800, Boqun Feng wrote:
> 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>
<...>

Thanks,
Boqun

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] sched/fair: code clean up for __sched_period()
  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:37     ` Boqun Feng
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Zijlstra @ 2015-07-06 12:49 UTC (permalink / raw)
  To: Boqun Feng; +Cc: Ingo Molnar, linux-kernel, Srikar Dronamraju

On Mon, Jul 06, 2015 at 08:41:26PM +0800, Boqun Feng wrote:
> Ping. Any idea on this one?

I think I queued this one.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] sched/fair: code clean up for __sched_period()
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2015-07-06 12:53 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Boqun Feng, Ingo Molnar, linux-kernel, Srikar Dronamraju


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Mon, Jul 06, 2015 at 08:41:26PM +0800, Boqun Feng wrote:
> > 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] sched/fair: code clean up for __sched_period()
  2015-07-06 12:49   ` Peter Zijlstra
  2015-07-06 12:53     ` Ingo Molnar
@ 2015-07-06 13:37     ` Boqun Feng
  1 sibling, 0 replies; 8+ messages in thread
From: Boqun Feng @ 2015-07-06 13:37 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, linux-kernel, Srikar Dronamraju

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

Hi Peter,

On Mon, Jul 06, 2015 at 02:49:59PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 06, 2015 at 08:41:26PM +0800, Boqun Feng wrote:
> > 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] sched/fair: code clean up for __sched_period()
  2015-07-06 12:53     ` Ingo Molnar
@ 2015-07-06 13:47       ` Boqun Feng
  0 siblings, 0 replies; 8+ messages in thread
From: Boqun Feng @ 2015-07-06 13:47 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, Srikar Dronamraju

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

Hi Ingo,

On Mon, Jul 06, 2015 at 02:53:50PM +0200, Ingo Molnar wrote:
> 
> * Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > On Mon, Jul 06, 2015 at 08:41:26PM +0800, Boqun Feng wrote:
> > > 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [tip:sched/core] sched/fair: Clean up the __sched_period() code
  2015-07-02 14:25 [PATCH] sched/fair: code clean up for __sched_period() Boqun Feng
  2015-07-06 12:41 ` Boqun Feng
@ 2015-07-06 15:51 ` tip-bot for Boqun Feng
  2015-07-07  6:49 ` tip-bot for Boqun Feng
  2 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Boqun Feng @ 2015-07-06 15:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: srikar, hpa, boqun.feng, tglx, torvalds, peterz, linux-kernel,
	mingo

Commit-ID:  42d1c60e15ff89150a3b3537fec579f8a8f36a8a
Gitweb:     http://git.kernel.org/tip/42d1c60e15ff89150a3b3537fec579f8a8f36a8a
Author:     Boqun Feng <boqun.feng@gmail.com>
AuthorDate: Thu, 2 Jul 2015 22:25:52 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
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.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1435847152-29543-1-git-send-email-boqun.feng@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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 a53a610..03ea05b 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;
 }
 
 /*

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [tip:sched/core] sched/fair: Clean up the __sched_period() code
  2015-07-02 14:25 [PATCH] sched/fair: code clean up for __sched_period() Boqun Feng
  2015-07-06 12:41 ` 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
  2 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Boqun Feng @ 2015-07-07  6:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, peterz, mingo, hpa, torvalds, boqun.feng, linux-kernel,
	srikar

Commit-ID:  8e2b0bf397279878babcb39b021edcafe7c945eb
Gitweb:     http://git.kernel.org/tip/8e2b0bf397279878babcb39b021edcafe7c945eb
Author:     Boqun Feng <boqun.feng@gmail.com>
AuthorDate: Thu, 2 Jul 2015 22:25:52 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
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.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1435847152-29543-1-git-send-email-boqun.feng@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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 a53a610..03ea05b 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;
 }
 
 /*

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-07-07  6:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-02 14:25 [PATCH] sched/fair: code clean up for __sched_period() Boqun Feng
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox