HomeFreeBSD

timerfd: Fix interval callout scheduling

Description

timerfd: Fix interval callout scheduling

When a timerfd interval callout misses its scheduled activation time, a
differential is calculated based on the actual activation time and the
scheduled activation time. This differential is divided by the timerfd's
interval time and the quotient is added to the timerfd's counter.

Before this change, the next callout was scheduled to activate at:
scheduled activation time + timerfd interval.

This change fixes the scheduling of the next callout to activate at:
actual activation time + timerfd interval - remainder.

Security: FreeBSD-26:06.timerfd
Approved by: so
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D55790
MFC after: 2 weeks

(cherry picked from commit 85c0f1a87da1fd1eb3e646e86f70e630c48da91a)
(cherry picked from commit 3c00f603a2801fd780666f9e94a26f264a887c90)

Details

Provenance
jfreeAuthored on Mar 20 2026, 6:33 AM
markjCommitted on Apr 21 2026, 3:45 PM
Reviewer
markj
Differential Revision
D55790: timerfd: Fix interval callout scheduling
Parents
rG4d22b3925df8: vm_fault: Reset m_needs_zeroing properly
Branches
Unknown
Tags
Unknown