sched/idle: disable tick in idle=poll idle entry
PATCH 1/1 sched/idle: disable tick in idle=poll idle entry
Commit a5183862e76fdc25f36b39c2489b816a5c66e2e5 ("tick/nohz: Conditionally restart tick on idle exit") allows a nohz_full CPU to enter idle and return from it with the scheduler tick disabled (since the tick might be undesired noise).
The idle=poll case still unconditionally restarts the tick when entering idle.
To reduce the noise for that case as well, stop the tick when entering idle, for the idle=poll case.
tick_nohz_idle_exit (called if the NEED_RESCHED bit is set) is responsible for re-enabling the tick when necessary.
---
kernel/sched/idle.c +1 -1
@@ -276,7 +276,7 @@ static void do_idle(void)* idle as we know that the IPI is going to arrive right away. */ if (cpu_idle_force_poll ||tick_check_broadcast_expired ()) { -tick_nohz_idle_restart_tick (); +tick_nohz_idle_stop_tick ();cpu_idle_poll (); }else {cpuidle_idle_call ();
Peter Zijlstra
maintainerQuoted 6 lines · Marcelo Tosatti
Commit
a5183862e76fdc25f36b39c2489b816a5c66e2e5("tick/nohz: Conditionally restart tick on idle exit") allows anohz_fullCPU to enter idle and return from it with the scheduler tick disabled (since the tick might be undesired noise).
Quoted 8 lines
The idle=poll case still unconditionally restarts the tick when entering idle.
To reduce the noise for that case as well, stop the tick when entering idle, for the idle=poll case.
tick_nohz_idle_exit(called if theNEED_RESCHEDbit is set) is responsible for re-enabling the tick when necessary.
Who cares and why?
Quoted 10 lines · Peter Zijlstra
Quoted 9 lines · Marcelo Tosatti
Commit
a5183862e76fdc25f36b39c2489b816a5c66e2e5("tick/nohz: Conditionally restart tick on idle exit") allows anohz_fullCPU to enter idle and return from it with the scheduler tick disabled (since the tick might be undesired noise).The idle=poll case still unconditionally restarts the tick when entering idle.
Quoted 7 lines
Quoted 5 lines
To reduce the noise for that case as well, stop the tick when entering idle, for the idle=poll case.
tick_nohz_idle_exit(called if theNEED_RESCHEDbit is set) is responsible for re-enabling the tick when necessary.Who cares and why?
Systems that use isolcpus/nohz_full, and use idle=poll to avoid sleeping. For example:
https://github.com/intel/FlexRAN/blob/master/README.md
More specifically, the case which HLTs (via nanosleep usually) is:
https://www.isa.org/intech-home/2022/february-2022/departments/what-you-may-not-know-about-softplcs
Can add this to the next version of the patch (unless you have any other comments).
Thanks.
Quoted 24 lines · Marcelo Tosatti
Commit
a5183862e76fdc25f36b39c2489b816a5c66e2e5("tick/nohz: Conditionally restart tick on idle exit") allows anohz_fullCPU to enter idle and return from it with the scheduler tick disabled (since the tick might be undesired noise).The idle=poll case still unconditionally restarts the tick when entering idle.
To reduce the noise for that case as well, stop the tick when entering idle, for the idle=poll case.
tick_nohz_idle_exit(called if theNEED_RESCHEDbit is set) is responsible for re-enabling the tick when necessary.Signed-off-by Marcelo Tosatti <[email protected]>---
kernel/sched/idle.c +0
-0
kernel/sched/idle.c static void do_idle(void) · line 280
Quoted 6 lines
kernel/sched/idle.c +1
-1@@ -276,7 +276,7 @@ static void do_idle(void)* idle as we know that the IPI is going to arrive right away. */ if (cpu_idle_force_poll ||tick_check_broadcast_expired ()) { -tick_nohz_idle_restart_tick (); +tick_nohz_idle_stop_tick ();cpu_idle_poll ();
cpu_idle_poll() re-enables interrupts and only checks need_resched(). If an interrupt happens and queues a new timer without waking up a task, the timer gets ignored.
Quoted 3 lines
kernel/sched/idle.c +0
-0}else {cpuidle_idle_call ();