From nobody Wed Jun 18 02:13:39 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bMS2q3yTgz5q6qH; Wed, 18 Jun 2025 02:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bMS2q2fGvz42H8; Wed, 18 Jun 2025 02:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750212819; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CmVvEJIfhayBdtNuPZFbGbZn3qOQxiojOh4TiSUuO2c=; b=wrfkfEiaRhF6ZqTwTMyN6k6Ow0X796pDVk1yDZUv3wCQsMZdBHUFH4bI1GXPP20IE63WzB sHNPWK7ojgzBWZ5eS20Qwq+5/uA5GYA7QQlQObdePTts1CdXY8MYY1X6HJARs8k9S33OTS Ctj+XzcX1xasq1+65I7xp/KdSxs6LGnwzbWuKP8VekBRhgE171chT6ekXseDjSI1W56Hcu VqPNVyj0NMZz8HBOGN7pwEj7TIkV75C8tFlvnEskgkbkT3NPngfFKEWZUfnSSQKKJxAJ+4 pU1VZRQ2eHzkilm6+YGlm3fXhQje2+tiHcln+hrNQL0sqPYXcVmv/tTfIQcIZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750212819; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CmVvEJIfhayBdtNuPZFbGbZn3qOQxiojOh4TiSUuO2c=; b=hGhgLdLRcKj4zDizZGn3u8w04ut+qlMhg5p2wJUv6I9eecha0HxDkL7DvKQCjF/JtUIBL7 A1OFjdQHwxocoRQY7N/ybyY2ijHlGcZO+VQ/OqIFmbaamXlZ4iIDySI9qRwaq9lAeMVXaz nip6cEMTA7u6J5KxWYGfPMLOTIGnb/wL5Ha3hYMWk0qFoljSR7Mq0/z6SLtT+6HfByqkJl zfq0+fDjdOapkxdtGbWoX0xvQBr2++TVuIFnjhqeZ6wsGh1ENQ1dohhVLF7rYmeoCX4zkm mA4R5VcmQcoMhnCFuh1KtyBr6LBIsfyDjyUB9udn6st4SWG1D/IgXf1x7HU8ng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750212819; a=rsa-sha256; cv=none; b=b0jl7CAklo0kjasyQDfvIZcJFMaTp//OI9bxio6CaMbsYcvu5iJVUMKTJeTaNN9UplAili 3arH1+ysxxJFo6djrEd8WJafY0IN4nlINu8KhWsw16ilT9sGKk0hyxJSot90rnIbftigjv 3v4i7+GhbFSJvow2uJx08FxTzsaXsC0icEekpVV7HNiGemTMBTD8057KqayR4SV908OQpe CInp8WsrHtb/EWoq9qVBZFqL5MEoh8WrRiTCT03dQmxinbwIjaRNlrIpJ9xxJyawWNqKmB OwRHEkhintXmDm4IQRTj9rXLgxK7Ax4tfH5BiW7RS09khfYTBMjWRzPyS8w+8Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bMS2q26Khz18k8; Wed, 18 Jun 2025 02:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55I2DdLt024910; Wed, 18 Jun 2025 02:13:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55I2DdRi024907; Wed, 18 Jun 2025 02:13:39 GMT (envelope-from git) Date: Wed, 18 Jun 2025 02:13:39 GMT Message-Id: <202506180213.55I2DdRi024907@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: eebc148f25c3 - main - sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eebc148f25c3012b943083b48fbfc13494e9c77f Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=eebc148f25c3012b943083b48fbfc13494e9c77f commit eebc148f25c3012b943083b48fbfc13494e9c77f Author: Olivier Certner AuthorDate: 2024-05-21 12:55:43 +0000 Commit: Olivier Certner 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)))