Who's counting jiffies when all CPUs idle in NO_HZ mode?

Who's counting jiffies when all CPUs idle in NO_HZ mode?

Shachar Shemesh shachar at shemesh.biz
Wed Mar 26 06:45:27 IST 2014


Oops!

The "one cpu always active" relates to the "full" tickless, not to the
idle tickless. Please disregard that answer, except the use of the
hardware clocks. I believe it is still valid, but I'll need to look at
the source code.

Shachar

On 26/03/14 06:38, Shachar Shemesh wrote:
> So I answer this here, and then I get a visit in the office with the
> same question... :-)
>
> On 25/03/14 23:04, Elazar Leibovich wrote:
>> (I'm talking now about MONOTONIC_CLOCK_RAW, not taking NTP adjustment
>> into account)
>>
>> To my understanding, the basic time counting mechanism at the Linux
>> kernel, is the jiffies counter. The way it counts time, is by
>> leveraging a CPU interrupt happening at a certain known frequency.
>> Every time this interrupt occurs, the interrupt handler would
>> increment a counter. By multiplying this counter with the IRQ's
>> frequency, we can estimate how much time passed.
>>
>> Now, to my understanding, the NO_HZ_IDLE=y configuration, would
>> prevent any interrupt on idle CPUs.
> At least for the time being, this does not mean what you think it
> means. See http://lwn.net/Articles/549580/
>
> Even in full tickless mode (properly referred to as "full" tickless
> mode), the boot CPU is still on a counter. Full ticklessness is still
> some way away.
>
> Even when we do achieve that lofty goal, most CPUs have a hardware
> counter that counts the time. Just like NAPI for network moved from an
> interrupt mode to polling mode for performance's sake, so we can do here.
>>
>> So to my understanding, if all CPUs are idle, nothing is going to run
>> on any CPU.
>>
> No.
>> Who would count jiffies then? How can we be sure how much time passed
>> with no hardware clock (as it is the case in some systems), and all
>> CPUs asleep?
> When we finally move into the utopian full tickless mode, jiffies will
> lose their original meaning. In full tickless mode, there is no base
> frequency for the clock. As such, jiffies become an arbitrary number
> based on which you can decide how much time has passed, and can be set
> to whatever. How low to set them becomes a question of power
> management, then.
>
> Shachar
>
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20140326/3c7581fc/attachment.html>


More information about the Linux-il mailing list