Re: [PATCH] timers: Fix up get_target_base() to use old base properly

From: Marcelo Tosatti
Date: Thu Jun 06 2019 - 11:32:57 EST


On Mon, Jun 03, 2019 at 09:29:44PM +0800, Peter Xu wrote:
> get_target_base() in the timer code is not using the "base" parameter
> at all. My gut feeling is that instead of removing that extra
> parameter, what we really want to do is "return the old base if it
> does not suite for a new one".

Hi Peter,

I think its a dead parameter: you always want to use the local base
if the timer is not pinned.

> CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> CC: John Stultz <john.stultz@xxxxxxxxxx>
> CC: Stephen Boyd <sboyd@xxxxxxxxxx>
> CC: Luiz Capitulino <lcapitulino@xxxxxxxxxx>
> CC: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
> CC: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
> ---
> kernel/time/timer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/time/timer.c b/kernel/time/timer.c
> index 343c7ba33b1c..6ff6ffd2c719 100644
> --- a/kernel/time/timer.c
> +++ b/kernel/time/timer.c
> @@ -868,7 +868,7 @@ get_target_base(struct timer_base *base, unsigned tflags)
> !(tflags & TIMER_PINNED))
> return get_timer_cpu_base(tflags, get_nohz_timer_target());
> #endif
> - return get_timer_this_cpu_base(tflags);
> + return base;
> }
>
> static inline void forward_timer_base(struct timer_base *base)
> --
> 2.17.1