Re: [patch 2/2] sched/idle: Make default_idle_call() NOHZ aware
From: K Prateek Nayak
Date: Mon Mar 02 2026 - 01:06:21 EST
Hello Thomas,
On 3/2/2026 1:00 AM, Thomas Gleixner wrote:
> +static void default_idle_enter(void)
> +{
> + this_cpu_write(nohz_data.entry_time, sched_clock());
> +}
> +
> +#else /* CONFIG_NO_HZ_COMMON */
> +static inline void default_idle_call(void { __default_idle_call(); }
^
s/void/void)/ to add a closing bracket here for !CONFIG_NO_HZ_COMMON.
> +static inline void default_idle_enter(void) { }
> +#endif /* !CONFIG_NO_HZ_COMMON */
> +
> static int call_cpuidle_s2idle(struct cpuidle_driver *drv,
> struct cpuidle_device *dev,
> u64 max_latency_ns)
> @@ -186,8 +236,6 @@ static void cpuidle_idle_call(void)
> }
>
> if (cpuidle_not_available(drv, dev)) {
> - tick_nohz_idle_stop_tick();
> -
> default_idle_call();
> goto exit_idle;
> }
> @@ -276,6 +324,7 @@ static void do_idle(void)
>
> __current_set_polling();
> tick_nohz_idle_enter();
> + default_idle_enter();
Can we defer this to until after do_idle() disables IRQs to avoid a
per-CPU write when we exit out immediately if it is semantically same?
As a bonus, we can then use __this_cpu_write().
>
> while (!need_resched()) {
>
>
>
--
Thanks and Regards,
Prateek