From nobody Tue Sep 29 10:32:51 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B6C03803E8; Sat, 8 Aug 2026 20:48:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786222115; cv=none; b=HOqilXRxRlxKkwfVrKbYusRQ8f+luxMe2kK9/F5Fl25ykTkK4hHu90Pnur8lUB/xpRz82q9yMsvY1vgtF+0b1mr5kF+SuZ7q/Aa+yw85JQmW1hMNBkwaPmqOEHVISkaInMDge+7eNe78zc6lSe0MlXsCWJjCNz0ec+3Y3ADpV3E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786222115; c=relaxed/simple; bh=9LfYfROQQE9MNAfQ6Q6z0kKR8L8Hg0D2QT/PbnEN8A8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=LQ2uE3WtPxxeWfYy7gx3860Ci6g04sOiwVmKwW5Ui4A+qXYzij8Dsi1KiHKDsOqVWI2vwWEEZ5tIygIfVIW5OSGU5FWKGNlo4n5eYWEumo6tthXM90WoK9Z4MIZ1hVOfqiTfQOWrUodwoLvREhz8TQYc8CXsI6hedZPmE0oi9rE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=NcN96ZFI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=+MKeSr5U; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NcN96ZFI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="+MKeSr5U" Date: Sat, 08 Aug 2026 20:48:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786222107; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZbtnkmEXYXTg+HqHp+ItFAwiHAYHIahg4pWHsjh2Kqw=; b=NcN96ZFI9fJy9D457Ttirfrc+wZgBwz7ut8eXvU6isG3WTKYGnoRoUEEffclHbD6yoUxBm 5PxG7KK9tN/Hj+obejIVVDjkdzr+n3IJ3zF5a7lDznhDS0ot/vnVopHzX02CJr5Lc8twqT uNo+cDyxU1kwCQy7snYKZgAf1a3ObodSvhhzwDvHAlknwVK4dCNnYq/eUPxTUGBrFT3jr/ aT/4chaJ/WiNmQEBqMjxjptptpS3vJSeh99jaeStLQ9NQdn8AuD2BeOLAz6ZkcL2DlxeCh oUyRAVRdTZpeLQJ/qte14HLPIBwkMUtSPBzPzYt9bBAwFBZ3DvOmoYKaWMZt/w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786222107; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZbtnkmEXYXTg+HqHp+ItFAwiHAYHIahg4pWHsjh2Kqw=; b=+MKeSr5UmEP/BjHv8OPr1RHfuUaqeYLGG07ttSmgend8/NfnNbUVpCfgsSPfgzgChsQgT5 xpHZURikA7dqJ6CA== From: "tip-bot2 for Boqun Feng" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] sched: Avoid signed comparison of preempt_count() in __cant_migrate() Cc: Boqun Feng , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260804161447.84806-10-boqun@kernel.org> References: <20260804161447.84806-10-boqun@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178622210558.442315.2431817868495969988.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the locking/core branch of tip: Commit-ID: 31f35d04a29a7554bb3b9ad827dd37c2942e31d4 Gitweb: https://git.kernel.org/tip/31f35d04a29a7554bb3b9ad827dd37c29= 42e31d4 Author: Boqun Feng AuthorDate: Tue, 04 Aug 2026 09:14:31 -07:00 Committer: Peter Zijlstra CommitterDate: Sat, 08 Aug 2026 22:44:08 +02:00 sched: Avoid signed comparison of preempt_count() in __cant_migrate() Currently preempt_count() is always a non-negative int on all archs (PREEMPT_NEED_RESCHED archs will mask out the MSB when returning preempt_count()), hence the checking in __cant_migrate() is in fact just checking whether preempt_count() is 0 or not. In a future change, we are going to use all the 32 bits of preempt_count(), which would make negative int values possible from preempt_count(). Therefore convert the "> 0" comparison into a zero check to prepare for the future change. No functional changes are intended. Signed-off-by: Boqun Feng Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260804161447.84806-10-boqun@kernel.org --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index aa116da..9b3f176 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -9241,7 +9241,7 @@ void __cant_migrate(const char *file, int line) if (!IS_ENABLED(CONFIG_PREEMPT_COUNT)) return; =20 - if (preempt_count() > 0) + if (preempt_count()) return; =20 if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)