git: 75a30ea09f4e - main - filt_timerexpire_l(): re-insert restarted timer into head instead of tail

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 13 Feb 2026 15:46:48 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=75a30ea09f4e75480743fae5c2369d50a6d8526c

commit 75a30ea09f4e75480743fae5c2369d50a6d8526c
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-02-12 20:24:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-02-13 15:46:41 +0000

    filt_timerexpire_l(): re-insert restarted timer into head instead of tail
    
    of the resumed timers list, so that kqtimer_proc_continue() does not
    iterated into the same timer again.
    
    PR:     293141
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Differential revision:  https://reviews.freebsd.org/D55264
---
 sys/kern/kern_event.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index a48408fd482a..85b7b6c953af 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -873,8 +873,13 @@ filt_timerexpire_l(struct knote *kn, bool proc_locked)
 			PROC_LOCK(p);
 		if (P_SHOULDSTOP(p) || P_KILLED(p)) {
 			if ((kc->flags & KQ_TIMER_CB_ENQUEUED) == 0) {
+				/*
+				 * Insert into head so that
+				 * kqtimer_proc_continue() does not
+				 * iterate into us again.
+				 */
 				kc->flags |= KQ_TIMER_CB_ENQUEUED;
-				TAILQ_INSERT_TAIL(&p->p_kqtim_stop, kc, link);
+				TAILQ_INSERT_HEAD(&p->p_kqtim_stop, kc, link);
 			}
 			if (!proc_locked)
 				PROC_UNLOCK(p);