From nobody Tue Apr 7 16:31:43 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 CB5593C3BFA; Thu, 12 Mar 2026 11:25:31 +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=1773314733; cv=none; b=fKSKG2o193ew5Z8A4jkzTd/Jn5PYfJOflEWp5HmXOwRNtnw9jqPIor41Gc/M354bMa4OeNXnC5oQ+EnDORBwReQZFNTGhgYYehQ4UO99MMvppct5yDfChRYI5gqhOVrK3NEiOKI/2bwEZPW9I9AtW3cdkjWN2mp92T9irzbR7t0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773314733; c=relaxed/simple; bh=QX8HPFMQf12Y5zfE8P4j5vXWymF88t5G1oLqLngKmzY=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=hIdE0xntC61NSJTCM6xuz2Aho9r3f9IjHDtHsb7eo08h8dlrTJ4xyVQ7rKRxpzms2ffFazqyumstngCQWdGBzBrJ/XfjPSNUUXQq7YVKUNc6tka41pu2fIT4+t9zEY0m6oeg8vcWNpeIzXIXFn3o4VYgm777glHWGyr3bgCjq+M= 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=0yt1khjE; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fJ4kVnTC; 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="0yt1khjE"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fJ4kVnTC" Date: Thu, 12 Mar 2026 11:25:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773314730; 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=M5lHSF++xZADSf/q1TPwIKc33qwXLrjR/6XDd9TQ5HI=; b=0yt1khjEdwRpvuCPCmLd/ZtxpkGT2AO948LJdc2/19dt/IQkF/GKiXj1fYBHtq+W+jMvr5 ucTd4nBAMVWKNQvgvzlAi7yUfGx4nvKjbfaHvZneOozArCLkkoYyJVVmYJbPlBcCB5Bajo ZSXKHCHXePaD6GIOatROWzAVusU1ZRgXpOR64AwkRyDAK7ExJdPry5w7dDclU9a87OG4dg wtty3bYyvFM00/0x/s01z6Nafg9eDU0gw7NnmT41vpa5+opFuCavcLBPSTZVX2jNTY5iVW bC8NlGPegtiJXn6XyHFvs2XCSiD7a036CuDyxghWMQ7C3xglLyQ0uydegGoLoQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773314730; 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=M5lHSF++xZADSf/q1TPwIKc33qwXLrjR/6XDd9TQ5HI=; b=fJ4kVnTCNuJZvPPG1pkqIZGC4C0gxHLk5L7kiiDZ5YppcPFRl7pp+qZpkCxgOHDEP9fYh2 eI3BO+iUDp9y3oCA== From: tip-bot2 for Thomas =?utf-8?q?Wei=C3=9Fschuh_=28Schneider_Electric=29?= Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] hrtimer: Add a helper to retrieve a hrtimer from its timerqueue node Cc: thomas.weissschuh@linutronix.de, Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260311-hrtimer-cleanups-v1-12-095357392669@linutronix.de> References: <20260311-hrtimer-cleanups-v1-12-095357392669@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177331472911.1647592.4241125829343098795.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: 88c316ff7694ddf55d5a0fe42602ae83bee560aa Gitweb: https://git.kernel.org/tip/88c316ff7694ddf55d5a0fe42602ae83b= ee560aa Author: Thomas Wei=C3=9Fschuh (Schneider Electric) AuthorDate: Wed, 11 Mar 2026 11:15:21 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 12 Mar 2026 12:15:56 +01:00 hrtimer: Add a helper to retrieve a hrtimer from its timerqueue node The container_of() call is open-coded multiple times. Add a helper macro. Use container_of_const() to preserve constness. Signed-off-by: Thomas Wei=C3=9Fschuh (Schneider Electric) Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260311-hrtimer-cleanups-v1-12-095357392669= @linutronix.de --- kernel/time/hrtimer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index a71e2ca..2db171b 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -534,6 +534,8 @@ static inline void debug_activate(struct hrtimer *timer= , enum hrtimer_mode mode, for (bool done =3D false; !done; active &=3D ~(1U << idx)) \ for (base =3D &cpu_base->clock_base[idx]; !done; done =3D true) =20 +#define hrtimer_from_timerqueue_node(_n) container_of_const(_n, struct hrt= imer, node) + #if defined(CONFIG_NO_HZ_COMMON) /* * Same as hrtimer_bases_next_event() below, but skips the excluded timer = and @@ -578,7 +580,7 @@ static __always_inline struct hrtimer *clock_base_next_= timer(struct hrtimer_cloc { struct timerqueue_linked_node *next =3D timerqueue_linked_first(&base->ac= tive); =20 - return container_of(next, struct hrtimer, node); + return hrtimer_from_timerqueue_node(next); } =20 /* Find the base with the earliest expiry */ @@ -1960,7 +1962,7 @@ static __always_inline struct hrtimer *clock_base_nex= t_timer_safe(struct hrtimer { struct timerqueue_linked_node *next =3D timerqueue_linked_first(&base->ac= tive); =20 - return next ? container_of(next, struct hrtimer, node) : NULL; + return next ? hrtimer_from_timerqueue_node(next) : NULL; } =20 static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_= t now, @@ -2439,7 +2441,7 @@ static void migrate_hrtimer_list(struct hrtimer_clock= _base *old_base, struct hrtimer *timer; =20 while ((node =3D timerqueue_linked_first(&old_base->active))) { - timer =3D container_of(node, struct hrtimer, node); + timer =3D hrtimer_from_timerqueue_node(node); BUG_ON(hrtimer_callback_running(timer)); debug_hrtimer_deactivate(timer); =20