Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jul 2025 13:31:39 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: cc604213b597 - stable/14 - sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range
Message-ID:  <202507281331.56SDVdpS082151@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by olce:

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

commit cc604213b59777b33c413e2d2c70f63d4c3665bf
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-05-21 12:55:43 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-07-28 13:28:42 +0000

    sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range
    
    The current formula wastes queues and degrades usage estimation
    precision, since any increase of ticks that goes over 40 priorities (so,
    8 * 40) is clamped to the last of these 40 levels (the nice value is
    subsequently added to that number to get the final priority level).
    
    Allow 'ts_estcpu' to grow up to a value corresponding to the greatest
    (i.e., lowest) priority of the timeshare range.
    
    MFC after:      1 month
    Event:          Kitchener-Waterloo Hackathon 202506
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D45392
    
    (cherry picked from commit eebc148f25c3012b943083b48fbfc13494e9c77f)
---
 sys/kern/sched_4bsd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index e9d180fde303..0e7ac9feb686 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -80,7 +80,9 @@ dtrace_vtime_switch_func_t	dtrace_vtime_switch_func;
 #endif
 #define	NICE_WEIGHT		1	/* Priorities per nice level. */
 #define	ESTCPULIM(e)							\
-	min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN)) \
+	min((e), INVERSE_ESTCPU_WEIGHT *				\
+	    (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) +			\
+	    PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE)			\
 	    + INVERSE_ESTCPU_WEIGHT - 1)
 
 #define	TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX)))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202507281331.56SDVdpS082151>