From nobody Fri Jun 26 01:45:56 2026 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 4gmdmn5KbLz6jkbj for ; Fri, 26 Jun 2026 01:46:01 +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 4gmdmn4k5Cz46q2 for ; Fri, 26 Jun 2026 01:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782438361; 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=6SdHXHjsyIvpt66X6gyPDo0PUPnCCYmGdl72nCSi+z8=; b=yhmTQOOS2GAXCKd673jGWW5q7rkHr5UjxDKBSE3C4LHkFLhm4220PvxmllA525fYgRzuiM PjMNOq8bWNcb0nV2baPvadT+JvgNplJVbrgCVD7AJRX+VFntxhYwiVw5LXs6UheVQrsCzO OmB5ca3LORNacTjdvE9VSYK6fN14ahuofKbL+ZLbqo6pdEcOSaWUnZ2XceAHTckFtOP8Li hVE3wexAVDw9Bgy86JtwaTWrOP4uYR2+Ne0cN/TxEeowxeRl31QLfdB7iZ0iC3MR1XV6uo b0O6z5V3B5/mi2jdiol7ZnkEbG9atsVKsXfGNhMO+N643ViVd5kSNy00ZL0AhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782438361; a=rsa-sha256; cv=none; b=VZpA16/IHQ5RGd6Cw2iK+dl0Oc7d1gkB9IyTE7jmVkBNuQa5s7MzF99tFGpdYg7M5fj2fm xiEkNYwJCrzriBcGyHh3vp0HkQMRZU7YubiBlQHHDUVcm1VoxusMKmzjPolLyhulfIffV3 Tm9HCOn59R2ilWEEafVtLdIQiYgCoUr4fYjJmEEso9BXRgCGyMSIxMGh4VRRga2TdgVi35 uMhXMdYbklP3/t6PkYtLfcFxwDZC4f+GbgquB5RvxgyAmQJf/gzIqUtMRDGIryyJZG+/2D b0xItBcquHkmwjSJIFiV32E4GhtJP7EMUBxkWUCvVLbqsWQAavMfD2AummlXRQ== 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=1782438361; 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=6SdHXHjsyIvpt66X6gyPDo0PUPnCCYmGdl72nCSi+z8=; b=s5I4JWRnbD4kGvS/onqCqTsxSMnN1hG8z/5XJut2tBesC3MhHzuse9Efu84cHfuHNebAK8 UO0eUWD44QS07BDPI+4giJeyivIx8vMiOUrUkTa6Pmf7e8UfnET3IPJhGUbd4WzMz2kNaY AFnoUmy+RNHjfUzRmyv0IkysE9J7FA90d5rQQrlsPPC/bTrTiMqvTJBU34wtZQOhhTYs+y R48v9goFySZotDHkoAdv7sVuwTW80a0/AV4wMll1NfMXhLrNpJwbj+pfMbhWhRaQZSN8uL QYtRD0rVbF/wnh8pgF4/AkbppsVsy35SdpdpiyFiLcosJ/4yWoGj6DhaHigijQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gmdmn3Knkz1rQ for ; Fri, 26 Jun 2026 01:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 426cb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 26 Jun 2026 01:45:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 961f48142868 - main - sched_ule: Fix off by one in preempt_thresh definition 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 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/main X-Git-Reftype: branch X-Git-Commit: 961f4814286820f242d8d5407b9fd7238e896936 Auto-Submitted: auto-generated Date: Fri, 26 Jun 2026 01:45:56 +0000 Message-Id: <6a3dd9d4.426cb.6203f418@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=961f4814286820f242d8d5407b9fd7238e896936 commit 961f4814286820f242d8d5407b9fd7238e896936 Author: Olivier Certner AuthorDate: 2026-06-19 01:51:32 +0000 Commit: Olivier Certner CommitDate: 2026-06-26 01:43:46 +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 --- 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