From nobody Fri Jul 24 04:35:02 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 4h5wBv1ZGnz6lsYY for ; Fri, 24 Jul 2026 04:35:03 +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 4h5wBt3ByWz3Z78 for ; Fri, 24 Jul 2026 04:35:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784867702; 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=ewyxCbnghgpaJR3jovKsE5DCFRPzYHuZPWzPnbDUr3A=; b=jlk7Ta/jKSzXAh6WkEwncmDEHtjYlDutyIWi+7tP4DQb3m5C7YtKmQpZxxo7OThwKuvs2a BE/Q+5ISCF/zfjdQZvjVCyH+2yYuT217OktqyU5RwKWfgB+IUujc2fwY0P4/dFIBMaB0OR TIRpRHAD9IzoVYnuqbiQDCodkO592UkGO0v79tZTwFL+UadBe7lljNxEn9Pkk/z82j8r/O iE9uKmHMmNt8X5fBnH6owRkMahc2FcnPVKtQwh1lYwVI0bNC1ku3MKT0D6OYfRyX+kDBCJ DWO4Vl6g7oSEkupynzzouWOg0Ufb4nJWgxmjvlkRLl+Wq11+sqh9Hk+IKwQE+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784867702; a=rsa-sha256; cv=none; b=v+ESoy43zvpLMQ0QcNvLR1CoCljMX2QfZutRoZXGwL9jUdMFo4ALHuYuUPGj8jk78V96I9 P1JZu26fgneJqanHZpNMWUkDTaalZN3JGRRqldRkcZo3zUuSRrkni6DXTC2yslSc5W501i bEGQdzE4o79HKBNIns9maEuGbiYz5aPdyp3EU16ABK/yzldnWymucrk1kNddV/Q5IE6QCU ar05tFJIG5mTwYdUb8LiS+ZGuvqcLUtbrUKL8yesnPonK7DCBb0DYXrQ6UEESIMuJV+Yx7 EDKARYRAYWPw3BtlFjCmRK6xIYm7udEa8eShp3nDQsxNYebcF/dEwt3/sl+kZw== 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=1784867702; 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=ewyxCbnghgpaJR3jovKsE5DCFRPzYHuZPWzPnbDUr3A=; b=eeoWy9h9PEsn6f5zvI736RTGqVW9v5ixjE4b9rafHAW50RHOpUkYAPROoh2nAiLn+nwarM MxnMcPGn8BB2xYEGIBSIEg1LGoVGNi7hR9OY5wlvnT/Fh7Vz6kbg6PXkwzxAvxrwCHwf4o k3/bGFuvoFN0rvKcNoN1Y8LvZR42WLSybEQFQoeipVziZdP5Eko3lsjK/2eFEleapitsnj 2f5Kc6oczT4QcBSn24THLI6tN7ZmKFoRQHoz0r+1b6F67Vg+dYe2H4zVlOhzM3uGMJGEGV ABZlVFia3M95AxG5C8ollNtCDr/hcoVZ9DINwdtE15zmug0hdZbjylbKHR+R/A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h5wBt1YM4zcPW for ; Fri, 24 Jul 2026 04:35:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 386e5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 24 Jul 2026 04:35:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: d0fc89b3ba93 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: d0fc89b3ba933100dbf8e22b5e94363d6ec88847 Auto-Submitted: auto-generated Date: Fri, 24 Jul 2026 04:35:02 +0000 Message-Id: <6a62eb76.386e5.7cb8348a@gitrepo.freebsd.org> The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=d0fc89b3ba933100dbf8e22b5e94363d6ec88847 commit d0fc89b3ba933100dbf8e22b5e94363d6ec88847 Author: Olivier Certner AuthorDate: 2026-06-19 01:51:32 +0000 Commit: Olivier Certner CommitDate: 2026-07-24 04:33:35 +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 c8d2712b89ef..eb00072b5012 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -236,7 +236,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 @@ -473,7 +473,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