[RFC PATCH 0/2] nohz idle time accounting cleanup

From: Ze Gao
Date: Thu May 30 2024 - 08:24:33 EST


Dear all,

Currently we use is_idle_task(current) check to decide if we need
to call tick_nohz_irq_enter() on irq entry but use idle_cpu() to
decide if we need to call tick_nohz_irq_exit() on irq exit.
and we rely this pair (which internally calls tick_nohz_stop_idle()
and tick_nohz_start_idle() separately) to do accurate idle time
accounting in most cases.

IIUC, idle_cpu() now is mainly for scheduler and for tick user,
we seem to ask less than what idle_cpu() gives us and the use of
idle_cpu() here only make things complicated which can be proved
by the introduction of sched_core_idle_cpu() for forcing idle
time accounting.

So I make this RFC to do this cleanup and make things simple again
here and it should introduce no functional changes.

Reviews welcome and please let me know if I'm being stupid
or missing something obvious.

Regards,
Ze

--

Ze Gao (2):
timer: Use is_idle_task() check instead of idle_cpu() on irq exit
sched/core: Remove sched_core_idle_cpu()

include/linux/sched.h | 2 --
kernel/sched/core.c | 13 -------------
kernel/softirq.c | 2 +-
3 files changed, 1 insertion(+), 16 deletions(-)

--
2.41.0