mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] timers: Remove duplicate setting of new_base in __mod_timer()
@ 2009-12-16 22:20 Simon Horman
  2009-12-16 23:58 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2009-12-16 22:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thomas Gleixner

Hi,

I am wondering if the first line of the following snippet of
__mod_timer() can be removed as new_base always seems to be reset.

Alternatively perhaps smp_processor_id() and  per_cpu() could
be moved to inside the #if and the call to __get_cpu_var() moved to
inside #else ?

        new_base = __get_cpu_var(tvec_bases);

        cpu = smp_processor_id();
        
#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
        if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) {
                int preferred_cpu = get_nohz_load_balancer();
                        
                if (preferred_cpu >= 0)
                        cpu = preferred_cpu;
        }
#endif
        new_base = per_cpu(tvec_bases, cpu);

Signed-off-by: Simon Horman <horms@verge.net.au>

Index: linux-2.6/kernel/timer.c
===================================================================
--- linux-2.6.orig/kernel/timer.c	2009-12-17 07:02:57.000000000 +0900
+++ linux-2.6/kernel/timer.c	2009-12-17 07:03:17.000000000 +0900
@@ -656,8 +656,6 @@ __mod_timer(struct timer_list *timer, un
 
 	debug_activate(timer, expires);
 
-	new_base = __get_cpu_var(tvec_bases);
-
 	cpu = smp_processor_id();
 
 #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)

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

* Re: [RFC] timers: Remove duplicate setting of new_base in __mod_timer()
  2009-12-16 22:20 [RFC] timers: Remove duplicate setting of new_base in __mod_timer() Simon Horman
@ 2009-12-16 23:58 ` Thomas Gleixner
  2009-12-17  0:07   ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2009-12-16 23:58 UTC (permalink / raw)
  To: Simon Horman; +Cc: LKML

B1;2005;0cSimon,

On Thu, 17 Dec 2009, Simon Horman wrote:

> I am wondering if the first line of the following snippet of
> __mod_timer() can be removed as new_base always seems to be reset.

Good catch.
 
> Alternatively perhaps smp_processor_id() and  per_cpu() could
> be moved to inside the #if and the call to __get_cpu_var() moved to
> inside #else ?

Nah, __get_cpu_var does a smp_processor_id() anyway. Removing that
first new_base assignment is the right thing to do.

>         new_base = __get_cpu_var(tvec_bases);
> 
>         cpu = smp_processor_id();
>         
> #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
>         if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) {
>                 int preferred_cpu = get_nohz_load_balancer();
>                         
>                 if (preferred_cpu >= 0)
>                         cpu = preferred_cpu;
>         }
> #endif
>         new_base = per_cpu(tvec_bases, cpu);
> 
> Signed-off-by: Simon Horman <horms@verge.net.au>
> 
> Index: linux-2.6/kernel/timer.c
> ===================================================================
> --- linux-2.6.orig/kernel/timer.c	2009-12-17 07:02:57.000000000 +0900
> +++ linux-2.6/kernel/timer.c	2009-12-17 07:03:17.000000000 +0900
> @@ -656,8 +656,6 @@ __mod_timer(struct timer_list *timer, un
>  
>  	debug_activate(timer, expires);
>  
> -	new_base = __get_cpu_var(tvec_bases);
> -
>  	cpu = smp_processor_id();
>  
>  #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)

Could you please resend the patch with a proper change log ?

Thanks,

	tglx
 

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

* Re: [RFC] timers: Remove duplicate setting of new_base in __mod_timer()
  2009-12-16 23:58 ` Thomas Gleixner
@ 2009-12-17  0:07   ` Simon Horman
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2009-12-17  0:07 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On Thu, Dec 17, 2009 at 12:58:27AM +0100, Thomas Gleixner wrote:
> B1;2005;0cSimon,
> 
> On Thu, 17 Dec 2009, Simon Horman wrote:
> 
> > I am wondering if the first line of the following snippet of
> > __mod_timer() can be removed as new_base always seems to be reset.
> 
> Good catch.
>  
> > Alternatively perhaps smp_processor_id() and  per_cpu() could
> > be moved to inside the #if and the call to __get_cpu_var() moved to
> > inside #else ?
> 
> Nah, __get_cpu_var does a smp_processor_id() anyway. Removing that
> first new_base assignment is the right thing to do.
> 
> >         new_base = __get_cpu_var(tvec_bases);
> > 
> >         cpu = smp_processor_id();
> >         
> > #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
> >         if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) {
> >                 int preferred_cpu = get_nohz_load_balancer();
> >                         
> >                 if (preferred_cpu >= 0)
> >                         cpu = preferred_cpu;
> >         }
> > #endif
> >         new_base = per_cpu(tvec_bases, cpu);
> > 
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> > 
> > Index: linux-2.6/kernel/timer.c
> > ===================================================================
> > --- linux-2.6.orig/kernel/timer.c	2009-12-17 07:02:57.000000000 +0900
> > +++ linux-2.6/kernel/timer.c	2009-12-17 07:03:17.000000000 +0900
> > @@ -656,8 +656,6 @@ __mod_timer(struct timer_list *timer, un
> >  
> >  	debug_activate(timer, expires);
> >  
> > -	new_base = __get_cpu_var(tvec_bases);
> > -
> >  	cpu = smp_processor_id();
> >  
> >  #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
> 
> Could you please resend the patch with a proper change log ?

Will do.


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

end of thread, other threads:[~2009-12-17  0:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-16 22:20 [RFC] timers: Remove duplicate setting of new_base in __mod_timer() Simon Horman
2009-12-16 23:58 ` Thomas Gleixner
2009-12-17  0:07   ` Simon Horman

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®