From nobody Thu Jul 23 10:01:04 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 4h5RTX6Mkwz6lVwS for ; Thu, 23 Jul 2026 10:01:04 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h5RTX4QSYz3WYc for ; Thu, 23 Jul 2026 10:01:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784800864; 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=41b7ppNVyVhdeAoQu7PpZ4XvEzrbP9/f64MrVyYbFJc=; b=ASY1qj5eDIIajYQ9Pxisxu4LdozYfTdfat8+sPOUb/cKpEBVc7GQBK05fglKTKUC04GIV9 ar7dcx79WlnNuGjD2Wn6mKOuwzV1vAf3NzsZceHz8OGrTdkUbsjh+oOt/ASIy5KgR2sFy8 v8m/RnsjmIq3afKo0mJEvvGgA+u/mfs/T55LJGc/cp/n211kXXFr3nvxwmIX3wNNgw+89d mkQ6k6j2mtzCRtkX5CYqTPx0mF6iCy3qMI5vxjiuIrltObCYh/1hgWKtD3h7eevsNpcb8W 7/EhHUsiPNwt7TdhPM8yz54zVWIRPxPHAXO1zk850i1fh/oisUQy7AZTAy70Aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784800864; a=rsa-sha256; cv=none; b=KKBt15iU4smhEtxCiJEwHKSP2+FWqOHvDUWK2L7/1dbls5UUOx8GWntyFY5R0TY76nyZbf Gs6ec1i/4ACzii2LNwfGr0xnoY2Nywql+vacTOESWCvxiysheJ9aIboC376wmdvS76jzWU m/wAhZJVtsMDiFRI7KqTLTWmuwkSyqTn1f4Kc9IWtloKaNEdyFHdW1IfIcbwekO2z1zut1 cME0rJB/35YGZLua60YPvcs2+Te77uOE2EVN3tkMrrwEbpevcIb/tGTV6WvhbR2c5YFlFc l7wlTCzNFXtfO8AaDeXtCmS9MsFGrEGQahwOo/th7N5PV0fl4Wp0Sm4ExUgTnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784800864; 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=41b7ppNVyVhdeAoQu7PpZ4XvEzrbP9/f64MrVyYbFJc=; b=FDIMUSooxw0WK+Y7yBvRB7jrbZQlkPl15xIFbLDnw0Gym7/xY2Yer5nMrMb1Gy1Hd4vg9l n9DMJ5mHfS0QxoLBLNsg3DoQbyqP7yJ1NPt0ypKzXbz7+pAknZafXxife3pJLymR5HeZv3 KVatPz6KVKAIftTeCGQBMZtKRskPmrmsdyDPZHjE1yxOESfrCzUfXrYs4kbZ9W5iwRUhKf hcVZQvN0nBwp9ZjXhWZb9bR82yPwgGA7QMA25v81l/Q2+NTLz8KWwISPb9PZenNIjE7LfF tJczL/chOS49/IUDqKxW1GqbG2RvnnWt+snrwomG/9aGkRylTOla1Qa4AP13eQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h5RTX3C4pz10st for ; Thu, 23 Jul 2026 10:01:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3cfd9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 23 Jul 2026 10:01:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 22b653332451 - stable/14 - sched_ule: Fix off by one in preempt_thresh definition 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 22b6533324517ef422cd1e1d2c6386aff83f94da Auto-Submitted: auto-generated Date: Thu, 23 Jul 2026 10:01:04 +0000 Message-Id: <6a61e660.3cfd9.7bc39d90@gitrepo.freebsd.org> The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=22b6533324517ef422cd1e1d2c6386aff83f94da commit 22b6533324517ef422cd1e1d2c6386aff83f94da Author: Olivier Certner AuthorDate: 2026-06-19 01:51:32 +0000 Commit: Olivier Certner CommitDate: 2026-07-23 09:59:12 +0000 sched_ule: Fix off by one in preempt_thresh definition Since 'preempt_thresh' is set to PRI_MIN_KERN by default, and comparison of the considered thread's priority with that threshold is done with '<=', PRI_MIN_KERN threads actually can preempt other threads, contrary to other non-interrupt kernel ones (between PRI_MIN_KERN + 1 and PRI_MAX_KERN). So, replace the comparison operator '<=' by '<'. The alternative would be to change the default value, but changing the comparison instead has the benefit to be consistent with the 0 setting (which forbids preemption entirely), since allowing only threads with priority 0 to preempt becomes possible. Consequently, we also change the default value for the FULL_PREEMPTION option by adding 1 to PRI_MAX_IDLE (in practice, that does not make any difference in the current setting, since no preemption will happen if the new priority value is not strictly lower than the current one, and PRI_MAX_IDLE is PRI_MAX, the highest possible priority). Reviewed by: markj Fixes: ae7a6b38d53f ("ULE 3.0: Fine grain scheduler locking and affinity improvements. (...)") MFC after: 2 weeks Event: Halifax Hackathon 202606 Location: jrm@'s dining room Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57828 (cherry picked from commit 961f4814286820f242d8d5407b9fd7238e896936) --- sys/kern/sched_ule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index aa5104e58d93..a6560aff931b 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -239,7 +239,7 @@ static int __read_mostly sched_slice = 10; /* reset during boot. */ static int __read_mostly sched_slice_min = 1; /* reset during boot. */ #ifdef PREEMPTION #ifdef FULL_PREEMPTION -static int __read_mostly preempt_thresh = PRI_MAX_IDLE; +static int __read_mostly preempt_thresh = PRI_MAX_IDLE + 1; #else static int __read_mostly preempt_thresh = PRI_MIN_KERN; #endif @@ -505,7 +505,7 @@ sched_shouldpreempt(int pri, int cpri, int remote) /* * Preempt if we exceed the threshold. */ - if (pri <= preempt_thresh) + if (pri < preempt_thresh) return (1); /* * If we're interactive or better and there is non-interactive