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.

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

(cherry picked from commit 85c0f1a87da1fd1eb3e646e86f70e630c48da91a)
(cherry picked from commit 9b785380f307e772eae0df017c982acd81d5879e)

Details

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