Search code examples
clinuxlinux-kernellinux-device-drivertiming

INITIAL_JIFFIES value on boot


I have read that on boot, jiffies is not initialized to zero, it is initialized to INITIAL_JIFFIES constant

From header file

  /*
   * Have the 32 bit jiffies value wrap 5 minutes after boot
   * so jiffies wrap bugs show up earlier.
   */
   #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))

How -300*HZ wraps 5 minutes after boot. Can anyone please explain me?


Solution

  • HZ is the number of clock ticks (jiffies) in 1 second.

    300 seconds is 5 minutes.

    Therefore 300 x HZ is the number of jiffies in 5 minutes.

    Therefore after 5 minutes, an initial value of -300 * HZ will have been incremented to 0.