Re: [PATCH] timer: Lazily wakup nohz CPU when adding new timer.
From: Yunhong Jiang
Date: Fri Oct 23 2015 - 18:20:48 EST
On Fri, Oct 23, 2015 at 07:49:51AM +0530, Viresh Kumar wrote:
> On 22-10-15, 14:40, Yunhong Jiang wrote:
> > A naive question is, why it's sure a tick will happen when the tickless
> > processor is in idle?
>
> How do you get this impression? I don't think anyone has said that.
Viresh, thanks for your reply for my question.
I got this impression from Frederic's comments on
http://marc.info/?l=linux-kernel&m=139048415303210&w=2, "So you simply rely
on the next tick to see the new timer. This should work with
CONFIG_NO_HZ_IDLE but not with CONFIG_NO_HZ_FULL since the target may be
running without the tick".
Per my understanding of this comment, it means we can rely on the next tick
for CONFIG_NO_HZ_IDLE, which means it's sure a tick will happen for
CONFIG_NO_HZ_IDLE, am I right?
>
> We are talking about deferrable timers, which by design are only
> required if the target CPU is not-idle. If it is idle, then the timer
> isn't required to be serviced until the CPU wakes up. And the CPU can
> take whatever time it wants to wake up again.
Hmm, per http://lxr.free-electrons.com/source/include/linux/timer.h#L51, the
deferreable timer will be serviced when the CPU eventually wakes up "with a
subsequent non-deferrable timer". If there is no non-deferrable timer, based
on Frederic's comments, we in fact depends on next tick.
My confusion is, why we are sure there is next tick on CONFIG_NO_HZ_IDLE
idle processor to wake it up. If there is no tick, and no other timer, will
the timer get no chance to be waken up at all? I don't think "deferred for
ever" is deferreable.
Thanks
-jyh
>
> > Is it because scheduler load balance is sure to send a
> > tick to the processor in future?
>
> No. We aren't expecting the CPU to wake up any time soon. Just ignore
> the deferrable timer.
>
> --
> viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/