The branch main has been updated by mchoo: URL: https://cgit.FreeBSD.org/src/commit/?id=cd33abbce5a5c3b454f00ca3d0ecd71c2234106c
commit cd33abbce5a5c3b454f00ca3d0ecd71c2234106c Author: Minsoo Choo <[email protected]> AuthorDate: 2026-08-24 02:25:37 +0000 Commit: Minsoo Choo <[email protected]> CommitDate: 2026-09-18 14:14:14 +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 --- 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 27fbd3c5bdca..cd039501b609 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -585,7 +585,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;
