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 3CA883A1CFF for ; Tue, 24 Feb 2026 16:37:22 +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=1771951042; cv=none; b=s7ynxsGG1NlmYMPAmfKxg94/Ys8MAgARxunYR9C83EIu5at/5n65Yvay9h/T9mhlIeWLYapsrwtmzi7OmqFg1nOhVQt1OumZsW2KOwVidWLGUyNRSTBTgOnMaBxANijB8Rp7CPKKk3f2R+jTiwjj99RVi6SxonSDbSELFoweT1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771951042; c=relaxed/simple; bh=V5hLFPfXUNuHS09Rb/NKMXpRP6SYrccxJ/BH6xDunQM=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=ZnLUBQJhXmNrbVjiWgCjIIFCBuxvDuAL0HvOhKgW9dcxDfSDgkzcSaM+NqeIiZZHWPLwCjc3RssxKdT9B/Ts8HtNNmh5cmGRCAQdDcD1rt0pFjcsgYXwGl/6KiBuRMiqn+FcC55/8xpnN98ZrNYT3lI/XVfAmrS4/24BLg9/qpQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gnyrzRb5; 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="gnyrzRb5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43D96C116D0; Tue, 24 Feb 2026 16:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771951042; bh=V5hLFPfXUNuHS09Rb/NKMXpRP6SYrccxJ/BH6xDunQM=; h=Date:From:To:Cc:Subject:References:From; b=gnyrzRb52hn8NSlH24eSd7Oe2Dcjz90X7kqOvVotlkh36+r/KIxAPUtJ7+SDEpfvf n/okhkjtr4bLs3M7lP78sq0LyWk1UMwVkhLYNrKkBLQZF49LVOmXz5zoAaIcgMggjC Waf/BR/kdeUj0HuWMrGoZp0vNwEnLntlQ8zAZDTmQM5GmQ1IsiezMYmApsmjq61IXl LLCoXWwpUyFBpojbprQcTUOBe8rojiiDVWJ4JwMNbm7OOOuWUtRpIt8cn/GaTjo3o+ UjeS77hBVP2x/FJsqkC5izwmoLv1ZtEng55hUmGvdmsgO2AaZAiFnfKZyHd/aOdDSK Lb4zBIa0cAL4g== Date: Tue, 24 Feb 2026 17:37:18 +0100 Message-ID: <20260224163430.475262618@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 26/48] hrtimer: Replace the bitfield in hrtimer_cpu_base 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 Use bool for the various flags as that creates better code in the hot path. Signed-off-by: Thomas Gleixner --- include/linux/hrtimer_defs.h | 10 +++++----- kernel/time/hrtimer.c | 25 +++++++++++++------------ 2 files changed, 18 insertions(+), 17 deletions(-) --- a/include/linux/hrtimer_defs.h +++ b/include/linux/hrtimer_defs.h @@ -83,11 +83,11 @@ struct hrtimer_cpu_base { unsigned int cpu; unsigned int active_bases; unsigned int clock_was_set_seq; - unsigned int hres_active : 1, - in_hrtirq : 1, - hang_detected : 1, - softirq_activated : 1, - online : 1; + bool hres_active; + bool in_hrtirq; + bool hang_detected; + bool softirq_activated; + bool online; #ifdef CONFIG_HIGH_RES_TIMERS unsigned int nr_events; unsigned short nr_retries; --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -741,7 +741,7 @@ static void hrtimer_switch_to_hres(void) pr_warn("Could not switch to high resolution mode on CPU %u\n", base->cpu); return; } - base->hres_active = 1; + base->hres_active = true; hrtimer_resolution = HIGH_RES_NSEC; tick_setup_sched_timer(true); @@ -1854,7 +1854,7 @@ static __latent_entropy void hrtimer_run now = hrtimer_update_base(cpu_base); __hrtimer_run_queues(cpu_base, now, flags, HRTIMER_ACTIVE_SOFT); - cpu_base->softirq_activated = 0; + cpu_base->softirq_activated = false; hrtimer_update_softirq_timer(cpu_base, true); raw_spin_unlock_irqrestore(&cpu_base->lock, flags); @@ -1881,7 +1881,7 @@ void hrtimer_interrupt(struct clock_even raw_spin_lock_irqsave(&cpu_base->lock, flags); entry_time = now = hrtimer_update_base(cpu_base); retry: - cpu_base->in_hrtirq = 1; + cpu_base->in_hrtirq = true; /* * Set expires_next to KTIME_MAX, which prevents that remote CPUs queue * timers while __hrtimer_run_queues() is expiring the clock bases. @@ -1892,7 +1892,7 @@ void hrtimer_interrupt(struct clock_even if (!ktime_before(now, cpu_base->softirq_expires_next)) { cpu_base->softirq_expires_next = KTIME_MAX; - cpu_base->softirq_activated = 1; + cpu_base->softirq_activated = true; raise_timer_softirq(HRTIMER_SOFTIRQ); } @@ -1905,12 +1905,12 @@ void hrtimer_interrupt(struct clock_even * against it. */ cpu_base->expires_next = expires_next; - cpu_base->in_hrtirq = 0; + cpu_base->in_hrtirq = false; raw_spin_unlock_irqrestore(&cpu_base->lock, flags); /* Reprogramming necessary ? */ if (!tick_program_event(expires_next, 0)) { - cpu_base->hang_detected = 0; + cpu_base->hang_detected = false; return; } @@ -1939,7 +1939,7 @@ void hrtimer_interrupt(struct clock_even * time away. */ cpu_base->nr_hangs++; - cpu_base->hang_detected = 1; + cpu_base->hang_detected = true; raw_spin_unlock_irqrestore(&cpu_base->lock, flags); delta = ktime_sub(now, entry_time); @@ -1987,7 +1987,7 @@ void hrtimer_run_queues(void) if (!ktime_before(now, cpu_base->softirq_expires_next)) { cpu_base->softirq_expires_next = KTIME_MAX; - cpu_base->softirq_activated = 1; + cpu_base->softirq_activated = true; raise_timer_softirq(HRTIMER_SOFTIRQ); } @@ -2239,13 +2239,14 @@ int hrtimers_cpu_starting(unsigned int c /* Clear out any left over state from a CPU down operation */ cpu_base->active_bases = 0; - cpu_base->hres_active = 0; - cpu_base->hang_detected = 0; + cpu_base->hres_active = false; + cpu_base->hang_detected = false; cpu_base->next_timer = NULL; cpu_base->softirq_next_timer = NULL; cpu_base->expires_next = KTIME_MAX; cpu_base->softirq_expires_next = KTIME_MAX; - cpu_base->online = 1; + cpu_base->softirq_activated = false; + cpu_base->online = true; return 0; } @@ -2303,7 +2304,7 @@ int hrtimers_cpu_dying(unsigned int dyin smp_call_function_single(ncpu, retrigger_next_event, NULL, 0); raw_spin_unlock(&new_base->lock); - old_base->online = 0; + old_base->online = false; raw_spin_unlock(&old_base->lock); return 0;