From nobody Fri Oct 02 15:34:59 2026 X-Original-To: dev-commits-src-all@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 4hxCX45K6rz6vb3b for ; Fri, 02 Oct 2026 15:35:00 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hxCX42Lqgz4Ylf for ; Fri, 02 Oct 2026 15:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790955300; 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=4596WXOhAsT8I0eHedMwPxUYT2nhZc2ps2JhnrBTfjg=; b=nJA/kBubxMSatdT4NNcj7NNxOw0JHXRFrkVvgZLy772OQFKL0+/VlQnOCO2ExgftRzRFnL zuzZRaNE0Vo6CKj0EVe0l55gkxSyR0gB1g4cXPaxxthqT3jtdmGbAC5uovE8qa0vtDkbtF svFtrBJ6cmtC+kcJyyFoBuePOS6+otQgfu/jZ7GO4LQG1hGxqkTPqr0GIVR+wUAccIJkTh psRBOoSaJ42G069ZaxUg0Rum4XUXmZKrKD7PUJMREpJddJgZ+UfFmdK9xvSE+niiDazYrJ wJzijntooKnmuvNXst5b0bYmi+of8sMK8J1e8i7rShqp23H6gFUXnYr96M2Jpg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790955300; b=Q3U8XUwMp6NQ8iPVIqwy0iiGGtvUcVPxpAj2Wb8LvQcl2iTftJMc1nvgHt8588fq9OeVBG EbPgQmZvtozgpJKiPza1AVd+Gv/JDKi4FSrbLh61q2qIlqhwkMA+G2aqbBsV4YIp0cO7gw 5JaBKje/fomBOOg6OmDEVMCLWRUcvo/ekgEY9XW+hlU6vMbqtIDmC3Rl3qAzF2r7Hp7RpO XeXW56dWNtdeS+04Cw3OMJUWkdCTfcap3KlUUAcYQP/G9byr2jGJ4rYqbdFIlUn9CU2I+D uirGipaTs6kmk7xMHkW+kOEav3sm7Pf3JeDAFFbB7CTTzkghBgHb7XY/Iay2Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790955300; 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=4596WXOhAsT8I0eHedMwPxUYT2nhZc2ps2JhnrBTfjg=; b=fxgM9bNEyDQ7Qb+IpdiO2YM2Z6PPaCLrbn84eYJbNHls0NiJ0S+4tT1lOPY+fNQ+sCWa6I yyuEgF2gZ6zz1ENVeJn9XwaNCJJC/LsvtKAJx52boqEEV9DpXKsf7tf7iT+g04XsvG6J/c fvVAWRTi3rWZA+b+EfRFmwJa7bIQkty2O3t94XKVGh8Bo9ZpTZhtzuE5hh8Y+IIK2f/spB jOQwPZq8iEymdpzT5YfwNQmzxnDZozQc/UessCY8eJWccZWnW209C82dY23wFHM9kLwqqm 9Pa2LFgNdF6RZXuKRQuSZSTH9X2Ab8SE9TSSlBUruKJsufi9qrA7qAv8UOsWmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hxCX36rmnzNft for ; Fri, 02 Oct 2026 15:34:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e3f4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 02 Oct 2026 15:34:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Minsoo Choo Subject: git: 8e83ca27529c - stable/15 - sched_4bsd: add static assertion for nice weight List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mchoo X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 8e83ca27529c190ab37fe4695c2aaebdc658c76c Auto-Submitted: auto-generated Date: Fri, 02 Oct 2026 15:34:59 +0000 Message-Id: <6abfcf23.3e3f4.48be96e2@gitrepo.freebsd.org> The branch stable/15 has been updated by mchoo: URL: https://cgit.FreeBSD.org/src/commit/?id=8e83ca27529c190ab37fe4695c2aaebdc658c76c commit 8e83ca27529c190ab37fe4695c2aaebdc658c76c Author: Minsoo Choo AuthorDate: 2026-08-24 02:25:32 +0000 Commit: Minsoo Choo CommitDate: 2026-10-02 15:34:29 +0000 sched_4bsd: add static assertion for nice weight When NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) exceeds the timeshare range, two CPU-bound threads with different nice values can have the same priority as their nice values are clamped to the timeshare range limit. Add static assertion on NICE_WEIGHT to ensure that there is always enough room for nice values in the both end of the timeshare priority range. Reviewed by: olce Approved by: olce (mentor) MFC after: 2 weeks Sponsored by: FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59396 (cherry picked from commit e90be6fdf08526624f407923d003b66efa23d304) --- sys/kern/sched_4bsd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 95170c1a4e02..f5f31ff4fbfe 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -72,6 +72,10 @@ */ #define INVERSE_ESTCPU_WEIGHT 8 /* 1 / (priorities per estcpu level). */ #define NICE_WEIGHT 1 /* Priorities per nice level. */ +_Static_assert(NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) + <= PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE, + "Priority range accounting for nice values cannot exceed the including " + "timeshare span."); #define ESTCPULIM(e) \ min((e), INVERSE_ESTCPU_WEIGHT * \ (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE - \