From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 001B73A7F73 for ; Tue, 24 Feb 2026 16:38:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771951121; cv=none; b=EfLJs0bhKLvmJ7hz6Cae6w0rTJPW2CSCeyhJdkh690KfVO40Veyqcg7axvBMmrlrYaSqwHu0kTxyK7jsqY88bow4Vw+8eA+2XMG/BQcD2tkcG+26pXxUhe/iKFaT8JHc5v5Wr+qJOb/3+o497sNgeyzmprLeo7CWHkZZH1y7Hcw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771951121; c=relaxed/simple; bh=wSWi8GYCC+SeYLMw04/ZuqmGQ5IaOFxtaMRMhBDZ/eE=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=AsZhTrU7lA6cd6nK60kf+f9F8y0cH0DXYxQC2N1k5wxviMoyKIfrifjcpWX0u729rZlcZW4/RNVDPOIQaU16Glrn16Ygrel47JOYdVJ6VsvkVmXh/gjGbwRFdCoWpKlVDdhO5mVCb7cpgyP6MoBUzUpj9RjECH1Kgp5y/+iRGzs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h7s0Bic2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="h7s0Bic2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E5F8C116D0; Tue, 24 Feb 2026 16:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771951120; bh=wSWi8GYCC+SeYLMw04/ZuqmGQ5IaOFxtaMRMhBDZ/eE=; h=Date:From:To:Cc:Subject:References:From; b=h7s0Bic2eVpkO93AEi7s1IuS956/6schqDkEhLkl2upWzU4+vxPwEpnSE7N4Y215Z s1klB1tHwg4j8/zQUiCBuj0kJ/8k7i1eOfuZaOcTBc8+c52kmBLvUHJ7EIPQ8WIEGz HXxX+s0XLHhN9h1gYxcvma6+dk90/PMWZWG8T+BwrNJ5pGB4qYtSf3yAbMJKOUyk92 bdlVS7pHwo5EB7PPahRxrUNo+Ij/3ygdpep4IeuuZL/Naufui78b9yc6rtM9c3Yl7u UojTzr0qmfrUZxfqxEsOBTsLXab+at5cBdZTE/iT72f6EtsEncADMrJB8zMR94N+2L sNGFnrRAALuAw== Date: Tue, 24 Feb 2026 17:38:37 +0100 Message-ID: <20260224163431.532927977@kernel.org> User-Agent: quilt/0.68 From: Thomas Gleixner To: LKML Cc: Anna-Maria Behnsen , John Stultz , Stephen Boyd , Daniel Lezcano , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , x86@kernel.org, Peter Zijlstra , Frederic Weisbecker , Eric Dumazet Subject: [patch 42/48] hrtimer: Simplify run_hrtimer_queues() References: <20260224163022.795809588@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Replace the open coded container_of() orgy with a trivial clock_base_next_timer() helper. Signed-off-by: Thomas Gleixner --- kernel/time/hrtimer.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1933,6 +1933,13 @@ static void __run_hrtimer(struct hrtimer base->running = NULL; } +static __always_inline struct hrtimer *clock_base_next_timer_safe(struct hrtimer_clock_base *base) +{ + struct timerqueue_node *next = timerqueue_getnext(&base->active); + + return next ? container_of(next, struct hrtimer, node) : NULL; +} + static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now, unsigned long flags, unsigned int active_mask) { @@ -1940,16 +1947,10 @@ static void __hrtimer_run_queues(struct struct hrtimer_clock_base *base; for_each_active_base(base, cpu_base, active) { - struct timerqueue_node *node; - ktime_t basenow; - - basenow = ktime_add(now, base->offset); - - while ((node = timerqueue_getnext(&base->active))) { - struct hrtimer *timer; - - timer = container_of(node, struct hrtimer, node); + ktime_t basenow = ktime_add(now, base->offset); + struct hrtimer *timer; + while ((timer = clock_base_next_timer(base))) { /* * The immediate goal for using the softexpires is * minimizing wakeups, not running timers at the