[Devel] [PATCH hci-8.1 v4 4/6] drivers/md/push_backup: fix mod_timer() usage

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 3 13:11:03 MSK 2026


On 11/3/26 11:03, Andrey Zhadchenko wrote:
> mod_timer() takes an absolute jiffies value, but both callers pass a
> relative one. After about 5 min uptime this causes the timer to fire
> and re-arm on every tick. This has not exploded because we still have
> checked pb->deadline_jiffies each time.

Hi Andrey,

The fix is right, the "5 min" is not. INITIAL_JIFFIES is
(unsigned long)(unsigned int)(-300*HZ): on 64-bit jiffies start at
about 2^32 - 300*HZ, and after 5 minutes only the low 32 bits wrap,
the unsigned long keeps growing. The relative values here are at most
5h*HZ, below the start value, so they are in the past from boot, and
the timer fires and re-arms on every tick whenever a write is delayed.
The late first expiry before the wrap exists on 32-bit only. Maybe:

  mod_timer() takes an absolute jiffies value, but both callers pass a
  relative one, which is always in the past. The timer fires and
  re-arms on every tick while a write is delayed. It has worked so far
  because pb_timer_func() checks pb->deadline_jiffies each time.

With that:

Reviewed-by: Konstantin Khorenko <khorenko at virtuozzo.com>

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list