From nobody Fri Apr 3 03:01:28 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 EDC4335838E; Tue, 24 Mar 2026 22:27:06 +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=1774391228; cv=none; b=m1qJDK8JsZNtPSe3n2G8t/Ho50xG/x8xxIEVBxmbqTK6rhkkRZEHHFwNw8qExdTCIC375q9O/bPA+LTEfpHw8yakoOyTUeMJ3mk8RBJ3arO2YZiDc2BO1YkRdGFhMD+QTQpCygPx7NpyT2k4pM+ECinP7PLqn4qtAxKI1W5XJQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774391228; c=relaxed/simple; bh=dEgxVGQ+XN8MxtKXCJSQQiSshXa7QR8Rng0vq4oiaPM=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=UPbdSVGWSikLUzTTScS2GEsbNi7K3bXqPDxMlOs5DLiQkkdiI77BOroj+de7Jtdiy44Yuq0n+1H5DYfTknqa3ZhuYwXe/5khlbhmDnjqbqyxwKjTx7Qkl/PHYkTdymLa3s27+DmVKLFyXLKzBiwqzZFYa5UkpeGF2Y1CwCn+C4c= 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=ceYxEw3Y; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=VmzcLL/m; 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="ceYxEw3Y"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VmzcLL/m" Date: Tue, 24 Mar 2026 22:27:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774391225; 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=xQ/hnh73COpUxFWRHUVYBgktoa8XinSDCfjzJgsBgTk=; b=ceYxEw3YrFAokP+nhRyxPS6Vu4QlCbDMdw117pF0eTmo5rLIkk75SjYrMf2Dxc+4BJkPju TS1xjlAOtWaNTW6Cxh+hxhYgiq/Ddl5JeHrm7+ZwMNmhuvrf9wFjAIP8cTc5g7iuzgE8Ds PHnAHt5jLLScY5McDJqYjpdFlHtugF0UYbVWnxXmC6Sw2xtasmWNSLF+HrPhePbHDdiVCE QdMXdrOw7PG7yS4i1WjvO3mc6qAgYg7P6xffOTqEdSMly8XXZzDxi+U2Pp9+2OZr3ed5PI FP9dNjwEUkpzluJCJuTwRzIawooMNt2gQfsh7vv9frNObfQGROSiqyBuwZE2ZQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774391225; 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=xQ/hnh73COpUxFWRHUVYBgktoa8XinSDCfjzJgsBgTk=; b=VmzcLL/mN0h+13NA5yTkF+Yh0BPla1uG7i6I1dkIRCxckFaU5QFBxM5f3WqdaebW9q+rEJ HCTYU9uDFx47pgDg== 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: timers/core] timers: Get this_cpu once while clearing the idle state Cc: Shrikanth Hegde , Thomas Gleixner , "Mukesh Kumar Chaurasiya (IBM)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260323193630.640311-5-sshegde@linux.ibm.com> References: <20260323193630.640311-5-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: <177439122409.1647592.2973729975485899497.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 timers/core branch of tip: Commit-ID: 551e49beb1752387aed09eb2a0ea4c82ed1f3a35 Gitweb: https://git.kernel.org/tip/551e49beb1752387aed09eb2a0ea4c82e= d1f3a35 Author: Shrikanth Hegde AuthorDate: Tue, 24 Mar 2026 01:06:30 +05:30 Committer: Thomas Gleixner CommitterDate: Tue, 24 Mar 2026 23:21:30 +01:00 timers: Get this_cpu once while clearing the idle state 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 saves a few cycles. Though tiny, repeated adds up. timer_clear_idle() is called with interrupts disabled. So cache the value once. Signed-off-by: Shrikanth Hegde Signed-off-by: Thomas Gleixner Reviewed-by: Mukesh Kumar Chaurasiya (IBM) Link: https://patch.msgid.link/20260323193630.640311-5-sshegde@linux.ibm.com --- kernel/time/timer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 7e1e3bd..04d928c 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2319,6 +2319,7 @@ u64 timer_base_try_to_set_idle(unsigned long basej, u= 64 basem, bool *idle) */ void timer_clear_idle(void) { + int this_cpu =3D smp_processor_id(); /* * We do this unlocked. The worst outcome is a remote pinned timer * enqueue sending a pointless IPI, but taking the lock would just @@ -2327,9 +2328,9 @@ void timer_clear_idle(void) * path. Required for BASE_LOCAL only. */ __this_cpu_write(timer_bases[BASE_LOCAL].is_idle, false); - if (tick_nohz_full_cpu(smp_processor_id())) + if (tick_nohz_full_cpu(this_cpu)) __this_cpu_write(timer_bases[BASE_GLOBAL].is_idle, false); - trace_timer_base_idle(false, smp_processor_id()); + trace_timer_base_idle(false, this_cpu); =20 /* Activate without holding the timer_base->lock */ tmigr_cpu_activate();