Re: [PATCH] timers: Fix up get_target_base() to use old base properly
From: Peter Xu
Date: Sun Jun 09 2019 - 21:10:20 EST
On Thu, Jun 06, 2019 at 12:28:08PM -0300, Marcelo Tosatti wrote:
> 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,
Hi, Marcelo,
>
> I think its a dead parameter: you always want to use the local base
> if the timer is not pinned.
Thanks for the comment.
But what if it was pinned? Could the old code always do right even in
the scenario I mentioned below?
https://lkml.org/lkml/2019/6/4/34
Also note that if the timer was not pinned, IMHO it'll go into the
check below and it seems to likely to have another timer base instead
of the local base if it's not a housekeeping cpu (because
get_nohz_timer_target() will always try to provision timers onto the
housekeeping ones), or did I misunderstand your comment?
#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
if (static_branch_likely(&timers_migration_enabled) &&
!(tflags & TIMER_PINNED))
return get_timer_cpu_base(tflags, get_nohz_timer_target());
#endif
Regards,
--
Peter Xu