Re: [PATCH v2 3/6] hrtimer,sched: Add fuzzy hrtimer mode for HRTICK
From: Thomas Gleixner
Date: Mon Feb 02 2026 - 09:07:05 EST
On Wed, Jan 21 2026 at 17:20, Peter Zijlstra wrote:
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -928,7 +928,8 @@ void hrtick_start(struct rq *rq, u64 del
> static void hrtick_rq_init(struct rq *rq)
> {
> INIT_CSD(&rq->hrtick_csd, __hrtick_start, rq);
> - hrtimer_setup(&rq->hrtick_timer, hrtick, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
> + hrtimer_setup(&rq->hrtick_timer, hrtick, CLOCK_MONOTONIC,
> + HRTIMER_MODE_REL_HARD | HRTIMER_MODE_FUZZY);
SHouldn't this be HRTIMER_MODE_REL_PINNED_HARD? I know it's set when
starting the timer, but I had to double check it.
> }
> #else /* !CONFIG_SCHED_HRTICK: */
> static inline void hrtick_clear(struct rq *rq)
> --- a/kernel/time/hrtimer.c
> +++ b/kernel/time/hrtimer.c
> @@ -1122,7 +1122,7 @@ static void __remove_hrtimer(struct hrti
> * an superfluous call to hrtimer_force_reprogram() on the
> * remote cpu later on if the same timer gets enqueued again.
> */
> - if (reprogram && timer == cpu_base->next_timer)
> + if (!timer->is_fuzzy && reprogram && timer == cpu_base->next_timer)
> hrtimer_force_reprogram(cpu_base, 1);
> }
>
> @@ -1269,6 +1269,19 @@ static int __hrtimer_start_range_ns(stru
> if (new_base->cpu_base->in_hrtirq)
> return 0;
>
> + if (timer->is_fuzzy) {
> + /*
> + * XXX fuzzy implies pinned! not sure how to deal with
> + * retrigger_next_event() for the !local case.
I'd rather say:
Fuzzy requires pinned as the lazy reprogramming only works
for CPU local timers.
> + */
> + WARN_ON_ONCE(!(mode & HRTIMER_MODE_PINNED));
Other than that:
Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Thanks,
tglx