Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jun 2025 02:13:39 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: eebc148f25c3 - main - sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range
Message-ID:  <202506180213.55I2DdRi024907@gitrepo.freebsd.org>

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

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

commit eebc148f25c3012b943083b48fbfc13494e9c77f
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-05-21 12:55:43 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-06-18 02:09:39 +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
---
 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 e7f61eb6ed63..753494983416 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?202506180213.55I2DdRi024907>