git: 8ad706ea6eef - stable/14 - sched_4bsd: fix vague comment

From: Minsoo Choo <mchoo_at_FreeBSD.org>
Date: Fri, 02 Oct 2026 15:50:03 UTC
The branch stable/14 has been updated by mchoo:

URL: https://cgit.FreeBSD.org/src/commit/?id=8ad706ea6eef230dee369a68de0b2ab562fab343

commit 8ad706ea6eef230dee369a68de0b2ab562fab343
Author:     Minsoo Choo <mchoo@FreeBSD.org>
AuthorDate: 2026-08-24 02:25:37 +0000
Commit:     Minsoo Choo <mchoo@FreeBSD.org>
CommitDate: 2026-10-02 15:44:54 +0000

    sched_4bsd: fix vague comment
    
    The comment "was incremented in schedcpu()" doesn't give enough
    background for decrementing ts_slptime by 1 (thus ignoring decay_cpu()
    for 1 ts_slptime). More accurately, ts_slptime is decremented by 1
    because decay_cpu() has already executed once in schedcpu() when
    ts_slptime was 1.
    
    Reviewed by:    olce
    Approved by:    olce (mentor)
    MFC after:      2 weeks
    Sponsored by:   FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D59406
    
    (cherry picked from commit cd33abbce5a5c3b454f00ca3d0ecd71c2234106c)
---
 sys/kern/sched_4bsd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 35685b06f7db..f66c73597b67 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -597,7 +597,8 @@ updatepri(struct thread *td)
 		ts->ts_estcpu = 0;
 	else {
 		newcpu = ts->ts_estcpu;
-		ts->ts_slptime--;	/* was incremented in schedcpu() */
+		/* schedcpu() performs one decay_cpu() on its own. */
+		ts->ts_slptime--;
 		while (newcpu && --ts->ts_slptime)
 			newcpu = decay_cpu(loadfac, newcpu);
 		ts->ts_estcpu = newcpu;