linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched: remove an unnecessary memory access, rq->cpu in __schedule()
@ 2016-02-11  2:59 Byungchul Park
  2016-02-17  8:31 ` Ingo Molnar
  2016-02-17 12:14 ` [tip:sched/core] sched/core: Remove dead statement in __schedule( ) tip-bot for Byungchul Park
  0 siblings, 2 replies; 4+ messages in thread
From: Byungchul Park @ 2016-02-11  2:59 UTC (permalink / raw)
  To: peterz, mingo; +Cc: linux-kernel

Is there any reason keeping this statement on the code?

-----8<-----
>From d8a387efb8199b69b6464970d6f9fc57cbcf0ab0 Mon Sep 17 00:00:00 2001
From: Byungchul Park <byungchul.park@lge.com>
Date: Thu, 11 Feb 2016 11:50:53 +0900
Subject: [PATCH] sched: remove an unnecessary memory access, rq->cpu in
 __schedule()

Remove an unnecessary assignment of variable not used any more.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 kernel/sched/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1315cec..501f5d9 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3193,7 +3193,6 @@ static void __sched notrace __schedule(bool preempt)
 
 		trace_sched_switch(preempt, prev, next);
 		rq = context_switch(rq, prev, next); /* unlocks the rq */
-		cpu = cpu_of(rq);
 	} else {
 		lockdep_unpin_lock(&rq->lock);
 		raw_spin_unlock_irq(&rq->lock);
-- 
1.9.1

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

* Re: [PATCH] sched: remove an unnecessary memory access, rq->cpu in __schedule()
  2016-02-11  2:59 [PATCH] sched: remove an unnecessary memory access, rq->cpu in __schedule() Byungchul Park
@ 2016-02-17  8:31 ` Ingo Molnar
  2016-02-17  8:48   ` Byungchul Park
  2016-02-17 12:14 ` [tip:sched/core] sched/core: Remove dead statement in __schedule( ) tip-bot for Byungchul Park
  1 sibling, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2016-02-17  8:31 UTC (permalink / raw)
  To: Byungchul Park; +Cc: peterz, linux-kernel


* Byungchul Park <byungchul.park@lge.com> wrote:

> Is there any reason keeping this statement on the code?
> 
> -----8<-----
> From d8a387efb8199b69b6464970d6f9fc57cbcf0ab0 Mon Sep 17 00:00:00 2001
> From: Byungchul Park <byungchul.park@lge.com>
> Date: Thu, 11 Feb 2016 11:50:53 +0900
> Subject: [PATCH] sched: remove an unnecessary memory access, rq->cpu in
>  __schedule()
> 
> Remove an unnecessary assignment of variable not used any more.
> 
> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> ---
>  kernel/sched/core.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 1315cec..501f5d9 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3193,7 +3193,6 @@ static void __sched notrace __schedule(bool preempt)
>  
>  		trace_sched_switch(preempt, prev, next);
>  		rq = context_switch(rq, prev, next); /* unlocks the rq */
> -		cpu = cpu_of(rq);
>  	} else {
>  		lockdep_unpin_lock(&rq->lock);
>  		raw_spin_unlock_irq(&rq->lock);

There's no memory access that I can see - GCC will optimize it out.

Having said that, it is a dead statement so can be removed. I fixed the title 
accordingly.

Thanks,

	Ingo

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

* Re: [PATCH] sched: remove an unnecessary memory access, rq->cpu in __schedule()
  2016-02-17  8:31 ` Ingo Molnar
@ 2016-02-17  8:48   ` Byungchul Park
  0 siblings, 0 replies; 4+ messages in thread
From: Byungchul Park @ 2016-02-17  8:48 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: peterz, linux-kernel

On Wed, Feb 17, 2016 at 09:31:09AM +0100, Ingo Molnar wrote:
> 
> * Byungchul Park <byungchul.park@lge.com> wrote:
> 
> > Is there any reason keeping this statement on the code?
> > 
> > -----8<-----
> > From d8a387efb8199b69b6464970d6f9fc57cbcf0ab0 Mon Sep 17 00:00:00 2001
> > From: Byungchul Park <byungchul.park@lge.com>
> > Date: Thu, 11 Feb 2016 11:50:53 +0900
> > Subject: [PATCH] sched: remove an unnecessary memory access, rq->cpu in
> >  __schedule()
> > 
> > Remove an unnecessary assignment of variable not used any more.
> > 
> > Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> > ---
> >  kernel/sched/core.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 1315cec..501f5d9 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -3193,7 +3193,6 @@ static void __sched notrace __schedule(bool preempt)
> >  
> >  		trace_sched_switch(preempt, prev, next);
> >  		rq = context_switch(rq, prev, next); /* unlocks the rq */
> > -		cpu = cpu_of(rq);
> >  	} else {
> >  		lockdep_unpin_lock(&rq->lock);
> >  		raw_spin_unlock_irq(&rq->lock);
> 
> There's no memory access that I can see - GCC will optimize it out.

Yes, gcc will do it. So I expect no performance effect.

> 
> Having said that, it is a dead statement so can be removed. I fixed the title 
> accordingly.

Thank you.

> 
> Thanks,
> 
> 	Ingo

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

* [tip:sched/core] sched/core: Remove dead statement in __schedule( )
  2016-02-11  2:59 [PATCH] sched: remove an unnecessary memory access, rq->cpu in __schedule() Byungchul Park
  2016-02-17  8:31 ` Ingo Molnar
@ 2016-02-17 12:14 ` tip-bot for Byungchul Park
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Byungchul Park @ 2016-02-17 12:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: byungchul.park, peterz, tglx, torvalds, linux-kernel, mingo, hpa

Commit-ID:  3223d052b79eb9b620d170584c417d60a8bfd649
Gitweb:     http://git.kernel.org/tip/3223d052b79eb9b620d170584c417d60a8bfd649
Author:     Byungchul Park <byungchul.park@lge.com>
AuthorDate: Thu, 11 Feb 2016 11:59:38 +0900
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 17 Feb 2016 09:32:03 +0100

sched/core: Remove dead statement in __schedule()

Remove an unnecessary assignment of variable not used any more.

( This has no runtime effects as GCC is smart enough to optimize
  this out. )

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1455159578-17256-1-git-send-email-byungchul.park@lge.com
[ Edited the changelog. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7e548bd..87ca0be 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3346,7 +3346,6 @@ static void __sched notrace __schedule(bool preempt)
 
 		trace_sched_switch(preempt, prev, next);
 		rq = context_switch(rq, prev, next); /* unlocks the rq */
-		cpu = cpu_of(rq);
 	} else {
 		lockdep_unpin_lock(&rq->lock);
 		raw_spin_unlock_irq(&rq->lock);

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

end of thread, other threads:[~2016-02-17 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-11  2:59 [PATCH] sched: remove an unnecessary memory access, rq->cpu in __schedule() Byungchul Park
2016-02-17  8:31 ` Ingo Molnar
2016-02-17  8:48   ` Byungchul Park
2016-02-17 12:14 ` [tip:sched/core] sched/core: Remove dead statement in __schedule( ) tip-bot for Byungchul Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).