From nobody Fri Apr 3 10:20:49 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 77D603DA7C2; Tue, 24 Mar 2026 09:10:02 +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=1774343408; cv=none; b=leGPJ+0fKdqrn7LZiqOUm/ntnoy4f/8W0m15Ok9+l5tn7Bfp0i6W1Ot1L/ObIC+iLQwmWOzIDfvEXCQUoDxPMlfZwWWc1WL8Paa6KGbLyK4j5X0GRD3arHiMaRsp49+izssAPWlrhe6YEyKn+28QSi6SVw6D87WpSabPYVKBSAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774343408; c=relaxed/simple; bh=0L14WZFY+vCPcQvhvqKF//dHHT+smS5O4Um8lKJK6ck=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=jUA/EBfipgO/XTkazXIy8hyoDuJHlAVRlPN76e4bKU7n7moVMC0qGPbQZveGcdZM+5hi4yk/8NETnb8ejR2Jpyp+PzPigafWCaR8KUjL2ElackDZkpMYb5qd33WApHYapeiMrTGgsMklhJIUAb9EshlhIkVL8ouHJc8bvFovBGU= 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=HwvNvCLv; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=D8mn5C60; 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="HwvNvCLv"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="D8mn5C60" Date: Tue, 24 Mar 2026 09:09:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774343400; 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=Qp+n8JMojsd3RlZ3foCcJTib3U7hoNJq8xaQY8AoRJU=; b=HwvNvCLve0yGNb7TvuP/eN33okem2fvzEk9YHNMJ/Dw65yT8bTSLD6Azm2elxHp/ktBTkw PQ7S7/GEk1v79Y4mhy5xNPuZF+AAwyNshXGC+NKTQmXsMq1ej9ozpBM6BY/oK6ULBH4SI2 2obup76Vi9xqCLV8RKlOEdcK44ktvxbWpTLdwIEYuGNwfYTEJjV9YYox0MRk7zVRncd2Sn iyRx72QwNxTQiDAkQpkFclTMvtCiUzDOA0XdTDaig1QQAei5z78EDYS4Nnp93+hn3ZhjrY 0pWFjwn+NvCEVceGpEIGPCPbjiP45j+rKXzCGUBDbp6jLiiCXSrjyoV7eIaB7w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774343400; 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=Qp+n8JMojsd3RlZ3foCcJTib3U7hoNJq8xaQY8AoRJU=; b=D8mn5C60TWCXFCCvc1cAxEQ8dz0i8aHOdbQWUVjIDl3zz8N3UOtlEoQSfrQIPrnFtMUmGc venp6tAIZz0yGNAQ== From: "tip-bot2 for Shrikanth Hegde" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Get this cpu once in find_new_ilb() Cc: Shrikanth Hegde , "Peter Zijlstra (Intel)" , "Mukesh Kumar Chaurasiya (IBM)" , K Prateek Nayak , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260323193630.640311-2-sshegde@linux.ibm.com> References: <20260323193630.640311-2-sshegde@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177434339917.1647592.3941873281578843669.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 sched/core branch of tip: Commit-ID: 76504bce4ee6b8757647e07bc1710dcac9acdc2e Gitweb: https://git.kernel.org/tip/76504bce4ee6b8757647e07bc1710dcac= 9acdc2e Author: Shrikanth Hegde AuthorDate: Tue, 24 Mar 2026 01:06:27 +05:30 Committer: Peter Zijlstra CommitterDate: Tue, 24 Mar 2026 10:07:04 +01:00 sched/fair: Get this cpu once in find_new_ilb() Calling smp_processor_id() on: - In CONFIG_DEBUG_PREEMPT=3Dy, if preemption/irq is disabled, then it does not print any warning. - In CONFIG_DEBUG_PREEMPT=3Dn, it doesn't do anything apart from getting __smp_processor_id So with both CONFIG_DEBUG_PREEMPT=3Dy/n, in preemption disabled section it is better to cache the value. It could save a few cycles. Though tiny, repeated in loop could add up to a small value. find_new_ilb is called in interrupt context. So preemption is disabled. So Hoist the this_cpu out of loop Signed-off-by: Shrikanth Hegde Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Mukesh Kumar Chaurasiya (IBM) Reviewed-by: K Prateek Nayak Link: https://patch.msgid.link/20260323193630.640311-2-sshegde@linux.ibm.com --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0a35a82..2265092 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12614,14 +12614,14 @@ static inline int on_null_domain(struct rq *rq) */ static inline int find_new_ilb(void) { + int this_cpu =3D smp_processor_id(); const struct cpumask *hk_mask; int ilb_cpu; =20 hk_mask =3D housekeeping_cpumask(HK_TYPE_KERNEL_NOISE); =20 for_each_cpu_and(ilb_cpu, nohz.idle_cpus_mask, hk_mask) { - - if (ilb_cpu =3D=3D smp_processor_id()) + if (ilb_cpu =3D=3D this_cpu) continue; =20 if (idle_cpu(ilb_cpu))