LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/idle: disable tick in idle=poll idle entry
@ 2023-06-08  1:10 Marcelo Tosatti
  2023-06-08  8:34 ` Peter Zijlstra
  2023-06-08 13:25 ` Frederic Weisbecker
  0 siblings, 2 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2023-06-08  1:10 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Rafael J. Wysocki, Peter Zijlstra, Thomas Gleixner, linux-kernel


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. 

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

---

diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index 342f58a329f5..fdc240988ea9 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -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();


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched/idle: disable tick in idle=poll idle entry
  2023-06-08  1:10 [PATCH] sched/idle: disable tick in idle=poll idle entry Marcelo Tosatti
@ 2023-06-08  8:34 ` Peter Zijlstra
  2023-06-09 13:54   ` Marcelo Tosatti
  2023-06-08 13:25 ` Frederic Weisbecker
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2023-06-08  8:34 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: Frederic Weisbecker, Rafael J. Wysocki, Thomas Gleixner,
	linux-kernel

On Wed, Jun 07, 2023 at 10:10:46PM -0300, Marcelo Tosatti wrote:
> 
> 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. 

Who cares and why?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched/idle: disable tick in idle=poll idle entry
  2023-06-08  1:10 [PATCH] sched/idle: disable tick in idle=poll idle entry Marcelo Tosatti
  2023-06-08  8:34 ` Peter Zijlstra
@ 2023-06-08 13:25 ` Frederic Weisbecker
  1 sibling, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2023-06-08 13:25 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: Rafael J. Wysocki, Peter Zijlstra, Thomas Gleixner, linux-kernel

On Wed, Jun 07, 2023 at 10:10:46PM -0300, Marcelo Tosatti wrote:
> 
> 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. 
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> ---
> 
> diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> index 342f58a329f5..fdc240988ea9 100644
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -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.

>  		} else {
>  			cpuidle_idle_call();
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched/idle: disable tick in idle=poll idle entry
  2023-06-08  8:34 ` Peter Zijlstra
@ 2023-06-09 13:54   ` Marcelo Tosatti
  0 siblings, 0 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2023-06-09 13:54 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Frederic Weisbecker, Rafael J. Wysocki, Thomas Gleixner,
	linux-kernel

On Thu, Jun 08, 2023 at 10:34:00AM +0200, Peter Zijlstra wrote:
> On Wed, Jun 07, 2023 at 10:10:46PM -0300, Marcelo Tosatti wrote:
> > 
> > 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. 
> 
> 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-09 19:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08  1:10 [PATCH] sched/idle: disable tick in idle=poll idle entry Marcelo Tosatti
2023-06-08  8:34 ` Peter Zijlstra
2023-06-09 13:54   ` Marcelo Tosatti
2023-06-08 13:25 ` Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).