Skip to contentSkip to conversation

sched: A few nohz_full improvements

PATCH In review Frederic Weisbecker 5 participants 15 messages Jun 19, 2017 – Jun 22, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover sched: A few nohz_full improvements

Hi,

As I was working on removing the remaining 1Hz, I stepped in the last (AFAIK) remaining buggy bits in scheduler_tick() on nohz_full.

Hopefully I can finally offload this tick in the next patchsets.

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
nohz/0hz

HEAD: c1811204f1fd1d170223c0d548a57456685e831d

Thanks,
Frederic
---

Frederic Weisbecker (3):
sched/loadavg: Generalize idle naming to nohz
nohz: Move idle balancer registration to idle path
sched: Spare idle load balancing on nohz_full CPUs

 Documentation/trace/ftrace.txt |  2 +-
 include/linux/sched/nohz.h     |  8 +++----
 kernel/sched/fair.c            |  4 ++++
 kernel/sched/loadavg.c         | 51 +++++++++++++++++++++---------------------
 kernel/time/tick-sched.c       |  9 ++++----
 5 files changed, 40 insertions(+), 34 deletions(-)
#1 lore raw

PATCH 1/3 sched/loadavg: Generalize idle naming to nohz

The loadavg naming code still assumes that nohz == idle whereas its code is actually handling well both nohz idle and nohz full.

So lets fix the naming according to what the code actually does.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 Documentation/trace/ftrace.txt |  2 +-
 include/linux/sched/nohz.h     |  8 +++----
 kernel/sched/loadavg.c         | 51 +++++++++++++++++++++---------------------
 kernel/time/tick-sched.c       |  4 ++--
 4 files changed, 33 insertions(+), 32 deletions(-)
Documentation/trace/ftrace.txt +1 -1
index 94a987b..fff8ff6 100644
@@ -1609,7 +1609,7 @@ Doing the same with chrt -r 5 and function-trace set.
   <idle>-0       3dN.2   14us : sched_avg_update <-__cpu_load_update
   <idle>-0       3dN.2   14us : _raw_spin_unlock <-cpu_load_update_nohz
   <idle>-0       3dN.2   14us : sub_preempt_count <-_raw_spin_unlock
-  <idle>-0       3dN.1   15us : calc_load_exit_idle <-tick_nohz_idle_exit
+  <idle>-0       3dN.1   15us : calc_load_nohz_stop <-tick_nohz_idle_exit
   <idle>-0       3dN.1   15us : touch_softlockup_watchdog <-tick_nohz_idle_exit
   <idle>-0       3dN.1   15us : hrtimer_cancel <-tick_nohz_idle_exit
   <idle>-0       3dN.1   15us : hrtimer_try_to_cancel <-hrtimer_cancel
include/linux/sched/nohz.h +4 -4
index 4995b71..7d3f75d 100644
@@ -23,11 +23,11 @@ static inline void set_cpu_sd_state_idle(void) { }
 #endif
 
 #ifdef CONFIG_NO_HZ_COMMON
-void calc_load_enter_idle(void);
-void calc_load_exit_idle(void);
+void calc_load_nohz_start(void);
+void calc_load_nohz_stop(void);
 #else
-static inline void calc_load_enter_idle(void) { }
-static inline void calc_load_exit_idle(void) { }
+static inline void calc_load_nohz_start(void) { }
+static inline void calc_load_nohz_stop(void) { }
 #endif /* CONFIG_NO_HZ_COMMON */
 
 #if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP)
kernel/sched/loadavg.c +26 -25

145 lines not on this page · raw message

kernel/time/tick-sched.c +2 -2
index 2046009..1c9a508 100644
@@ -786,7 +786,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
 	 */
 	if (!ts->tick_stopped) {
 		nohz_balance_enter_idle(cpu);
-		calc_load_enter_idle();
+		calc_load_nohz_start();
 		cpu_load_update_nohz_start();
 
 		ts->last_tick = hrtimer_get_expires(&ts->sched_timer);
@@ -833,7 +833,7 @@ static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now)
 	 */
 	timer_clear_idle();
 
-	calc_load_exit_idle();
+	calc_load_nohz_stop();
 	touch_softlockup_watchdog_sched();
 	/*
 	 * Cancel the scheduled timer and restore the tick
Signature · 1 line
2.7.4
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] sched/loadavg: Generalize idle naming to nohz

Quoted 11 lines · Frederic Weisbecker

The loadavg naming code still assumes that nohz == idle whereas its code
is actually handling well both nohz idle and nohz full.

So lets fix the naming according to what the code actually does.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Peter Zijlstra <[email protected]>
Signature · 1 line
All rights reversed
#3 lore raw

[tip:sched/core] sched/loadavg: Generalize "_idle" naming to "_nohz"

In reply to Frederic Weisbecker
sched/loadavg: Generalize "_idle" naming to "_nohz"
Commit-ID:  3c85d6db5e5f05ae6c3d7f5a0ceceb43746a5ca7
Gitweb:     http://git.kernel.org/tip/3c85d6db5e5f05ae6c3d7f5a0ceceb43746a5ca7
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Mon, 19 Jun 2017 04:12:00 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 22 Jun 2017 11:30:01 +0200

sched/loadavg: Generalize "_idle" naming to "_nohz"

The loadavg naming code still assumes that nohz == idle whereas its code is actually handling well both nohz idle and nohz full.

So lets fix the naming according to what the code actually does, to unconfuse the reader.

---
 Documentation/trace/ftrace.txt |  2 +-
 include/linux/sched/nohz.h     |  8 +++----
 kernel/sched/loadavg.c         | 51 +++++++++++++++++++++---------------------
 kernel/time/tick-sched.c       |  4 ++--
 4 files changed, 33 insertions(+), 32 deletions(-)
Documentation/trace/ftrace.txt +1 -1
index 94a987b..fff8ff6 100644
@@ -1609,7 +1609,7 @@ Doing the same with chrt -r 5 and function-trace set.
   <idle>-0       3dN.2   14us : sched_avg_update <-__cpu_load_update
   <idle>-0       3dN.2   14us : _raw_spin_unlock <-cpu_load_update_nohz
   <idle>-0       3dN.2   14us : sub_preempt_count <-_raw_spin_unlock
-  <idle>-0       3dN.1   15us : calc_load_exit_idle <-tick_nohz_idle_exit
+  <idle>-0       3dN.1   15us : calc_load_nohz_stop <-tick_nohz_idle_exit
   <idle>-0       3dN.1   15us : touch_softlockup_watchdog <-tick_nohz_idle_exit
   <idle>-0       3dN.1   15us : hrtimer_cancel <-tick_nohz_idle_exit
   <idle>-0       3dN.1   15us : hrtimer_try_to_cancel <-hrtimer_cancel
include/linux/sched/nohz.h +4 -4
index 4995b71..7d3f75d 100644
@@ -23,11 +23,11 @@ static inline void set_cpu_sd_state_idle(void) { }
 #endif
 
 #ifdef CONFIG_NO_HZ_COMMON
-void calc_load_enter_idle(void);
-void calc_load_exit_idle(void);
+void calc_load_nohz_start(void);
+void calc_load_nohz_stop(void);
 #else
-static inline void calc_load_enter_idle(void) { }
-static inline void calc_load_exit_idle(void) { }
+static inline void calc_load_nohz_start(void) { }
+static inline void calc_load_nohz_stop(void) { }
 #endif /* CONFIG_NO_HZ_COMMON */
 
 #if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP)
kernel/sched/loadavg.c +26 -25

145 lines not on this page · raw message

kernel/time/tick-sched.c +2 -2
index 9c2dc64..b1b58a0 100644
@@ -783,7 +783,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
 	 */
 	if (!ts->tick_stopped) {
 		nohz_balance_enter_idle(cpu);
-		calc_load_enter_idle();
+		calc_load_nohz_start();
 		cpu_load_update_nohz_start();
 
 		ts->last_tick = hrtimer_get_expires(&ts->sched_timer);
@@ -823,7 +823,7 @@ static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now)
 	 */
 	timer_clear_idle();
 
-	calc_load_exit_idle();
+	calc_load_nohz_stop();
 	touch_softlockup_watchdog_sched();
 	/*
 	 * Cancel the scheduled timer and restore the tick
#4 lore raw

PATCH 2/3 nohz: Move idle balancer registration to idle path

In reply to Frederic Weisbecker

The idle load balancing registration path assumes that we only stop the tick when the CPU is idle, ignoring the nohz full case. As a result, a nohz full CPU that is running a task may be chosen to perform idle load balancing.

Lets make sure that only CPUs in dynticks idle mode can be picked as idle load balancers.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 kernel/time/tick-sched.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/time/tick-sched.c +3 -2
index 1c9a508..77c3be5 100644
@@ -785,7 +785,6 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
 	 * the scheduler tick in nohz_restart_sched_tick.
 	 */
 	if (!ts->tick_stopped) {
-		nohz_balance_enter_idle(cpu);
 		calc_load_nohz_start();
 		cpu_load_update_nohz_start();
 
@@ -938,8 +937,10 @@ static void __tick_nohz_idle_enter(struct tick_sched *ts)
 			ts->idle_expires = expires;
 		}
 
-		if (!was_stopped && ts->tick_stopped)
+		if (!was_stopped && ts->tick_stopped) {
 			ts->idle_jiffies = ts->last_jiffies;
+			nohz_balance_enter_idle(cpu);
+		}
 	}
 }
 
Signature · 1 line
2.7.4
Acked-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] nohz: Move idle balancer registration to idle path

Quoted 10 lines · Frederic Weisbecker

The idle load balancing registration path assumes that we only stop the
tick when the CPU is idle, ignoring the nohz full case. As a result, a
nohz full CPU that is running a task may be chosen to perform idle load
balancing.

Lets make sure that only CPUs in dynticks idle mode can be picked as idle load balancers.

Woah. Dang.

Quoted 5 lines
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Peter Zijlstra <[email protected]>
Signature · 1 line
All rights reversed
#6 lore raw

[tip:sched/core] nohz: Move idle balancer registration to the idle path

In reply to Frederic Weisbecker
nohz: Move idle balancer registration to the idle path
Commit-ID:  a0db971e4eb69fc84eb3d7ef94f718b483550b4a
Gitweb:     http://git.kernel.org/tip/a0db971e4eb69fc84eb3d7ef94f718b483550b4a
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Mon, 19 Jun 2017 04:12:01 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 22 Jun 2017 11:30:01 +0200

nohz: Move idle balancer registration to the idle path

The idle load balancing registration path assumes that we only stop the tick when the CPU is idle, ignoring the nohz full case. As a result, a nohz full CPU that is running a task may be chosen to perform idle load balancing.

Lets make sure that only CPUs in dynticks idle mode can be picked as idle load balancers.

---
 kernel/time/tick-sched.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/time/tick-sched.c +3 -2
index b1b58a0..db023e9 100644
@@ -782,7 +782,6 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
 	 * the scheduler tick in nohz_restart_sched_tick.
 	 */
 	if (!ts->tick_stopped) {
-		nohz_balance_enter_idle(cpu);
 		calc_load_nohz_start();
 		cpu_load_update_nohz_start();
 
@@ -923,8 +922,10 @@ static void __tick_nohz_idle_enter(struct tick_sched *ts)
 			ts->idle_expires = expires;
 		}
 
-		if (!was_stopped && ts->tick_stopped)
+		if (!was_stopped && ts->tick_stopped) {
 			ts->idle_jiffies = ts->last_jiffies;
+			nohz_balance_enter_idle(cpu);
+		}
 	}
 }
 
#7 lore raw

PATCH 3/3 sched: Spare idle load balancing on nohz_full CPUs

In reply to Frederic Weisbecker

Although idle load balancing obviously only concern idle CPUs, it can be a disturbance on a busy nohz_full CPU. Indeed a CPU can only get rid of an idle load balancing duty once a tick fires while it runs a task and this can take a while in a nohz_full CPU.

We could fix that and escape the idle load balancing duty from the very idle exit path but that would bring unecessary overhead. Lets just not bother and leave that job to housekeeping CPUs (those outside nohz_full range). The nohz_full CPUs simply don't want any disturbance.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 kernel/sched/fair.c | 4 ++++
 1 file changed, 4 insertions(+)
kernel/sched/fair.c +4 -0
index d711093..cfca960 100644
@@ -8659,6 +8659,10 @@ void nohz_balance_enter_idle(int cpu)
 	if (!cpu_active(cpu))
 		return;
 
+	/* Spare idle load balancing on CPUs that don't want to be disturbed */
+	if (!is_housekeeping_cpu(cpu))
+		return;
+
 	if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
 		return;
 
Signature · 1 line
2.7.4
#8 lore raw

Re: [PATCH 3/3] sched: Spare idle load balancing on nohz_full CPUs

Quoted 36 lines · Frederic Weisbecker

Although idle load balancing obviously only concern idle CPUs, it can be a disturbance on a busy nohz_full CPU. Indeed a CPU can only get rid
of an idle load balancing duty once a tick fires while it runs a task and this can take a while in a nohz_full CPU.

We could fix that and escape the idle load balancing duty from the very
idle exit path but that would bring unecessary overhead. Lets just not
bother and leave that job to housekeeping CPUs (those outside nohz_full
range). The nohz_full CPUs simply don't want any disturbance.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Peter Zijlstra <[email protected]>

---
 kernel/sched/fair.c | 4 ++++

 1 file changed, 4 insertions(+)
kernel/sched/fair.c +0 -0
index d711093..cfca960 100644
@@ -8659,6 +8659,10 @@ void nohz_balance_enter_idle(int cpu)
  	if (!cpu_active(cpu))
  		return;

kernel/sched/fair.c +1 -0
+	/* Spare idle load balancing on CPUs that don't want to be

disturbed */

kernel/sched/fair.c +3 -0
+	if (!is_housekeeping_cpu(cpu))
+		return;
+
Quoted 2 lines

  if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu))) return;

I am not entirely convinced on this one.

Doesn't the if (on_null_domain(cpu_rq(cpu)) test
a few lines down take care of this already?

Do we want nohz_full to always automatically
imply that no idle balancing will happen, like
on isolated CPUs?

Signature · 1 line
All rights reversed
#9 lore raw

Re: [PATCH 3/3] sched: Spare idle load balancing on nohz_full CPUs

Quoted 42 lines · Rik van Riel
Quoted 36 lines · Frederic Weisbecker

Although idle load balancing obviously only concern idle CPUs, it can be a disturbance on a busy nohz_full CPU. Indeed a CPU can only get rid
of an idle load balancing duty once a tick fires while it runs a task and this can take a while in a nohz_full CPU.

We could fix that and escape the idle load balancing duty from the very
idle exit path but that would bring unecessary overhead. Lets just not
bother and leave that job to housekeeping CPUs (those outside nohz_full
range). The nohz_full CPUs simply don't want any disturbance.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Peter Zijlstra <[email protected]>

---
 kernel/sched/fair.c | 4 ++++

 1 file changed, 4 insertions(+)
kernel/sched/fair.c +0 -0
index d711093..cfca960 100644
@@ -8659,6 +8659,10 @@ void nohz_balance_enter_idle(int cpu)
  	if (!cpu_active(cpu))
  		return;

kernel/sched/fair.c +1 -0
+	/* Spare idle load balancing on CPUs that don't want to be

disturbed */

kernel/sched/fair.c +3 -0
+	if (!is_housekeeping_cpu(cpu))
+		return;
+
Quoted 2 lines

  if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu))) return;

I am not entirely convinced on this one.

Quoted 6 lines

Doesn't the if (on_null_domain(cpu_rq(cpu)) test
a few lines down take care of this already?

Do we want nohz_full to always automatically
imply that no idle balancing will happen, like
on isolated CPUs?

IMO, nohz_full capable CPUs that are not isolated should automatically become housekeepers, and nohz_full _active_ upon becoming isolated. When a used as a housekeeper, you still pay a price for having the nohz_full capability available, but it doesn't have to be as high.

In my kernels, I use cpusets to turn nohz on/off set wise, so CPUs can be ticking, dyntick, nohz_full or housekeeper, RT load balancing and cpupri on/off as well if you want to assume full responsibility.  It's a tad (from box of xxl tads) ugly, but more flexible.

-Mike

#10 lore raw

Re: [PATCH 3/3] sched: Spare idle load balancing on nohz_full CPUs

Quoted 46 lines · Mike Galbraith
Quoted 45 lines · Rik van Riel
Quoted 36 lines · Frederic Weisbecker

Although idle load balancing obviously only concern idle CPUs, it can be a disturbance on a busy nohz_full CPU. Indeed a CPU can only get rid
of an idle load balancing duty once a tick fires while it runs a task and this can take a while in a nohz_full CPU.

We could fix that and escape the idle load balancing duty from the very
idle exit path but that would bring unecessary overhead. Lets just not
bother and leave that job to housekeeping CPUs (those outside nohz_full
range). The nohz_full CPUs simply don't want any disturbance.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Peter Zijlstra <[email protected]>

---
 kernel/sched/fair.c | 4 ++++

 1 file changed, 4 insertions(+)
kernel/sched/fair.c +0 -0
index d711093..cfca960 100644
@@ -8659,6 +8659,10 @@ void nohz_balance_enter_idle(int cpu)
  	if (!cpu_active(cpu))
  		return;

kernel/sched/fair.c +1 -0
+	/* Spare idle load balancing on CPUs that don't want to be

disturbed */

kernel/sched/fair.c +3 -0
+	if (!is_housekeeping_cpu(cpu))
+		return;
+
Quoted 2 lines

  if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu))) return;

I am not entirely convinced on this one.

Doesn't the if (on_null_domain(cpu_rq(cpu)) test
a few lines down take care of this already?

Quoted 8 lines
Quoted 3 lines

Do we want nohz_full to always automatically
imply that no idle balancing will happen, like
on isolated CPUs?

IMO, nohz_full capable CPUs that are not isolated should automatically become housekeepers, and nohz_full _active_ upon becoming isolated. When a used as a housekeeper, you still pay a price for having the nohz_full capability available, but it doesn't have to be as high.

That's right. So in the end checking for housekeeper on idle load balancing is something we want, but not with the current definition of housekeepers which is every CPU outside of nohz_full.

I should set this patch aside until I manage to decouple housekeeping from nohz_full.

Quoted 4 lines

In my kernels, I use cpusets to turn nohz on/off set wise, so CPUs can be ticking, dyntick, nohz_full or housekeeper, RT load balancing and cpupri on/off as well if you want to assume full responsibility.  It's a tad (from box of xxl tads) ugly, but more flexible.

Indeed I think that, in the end, driving the isolation "intensity" through cpusets is a good idea. It's going to be quite a headache in the case of nohz_full though if we want to avoid races against tick dependency, cputime accounting.

But at least I can start to move the other various isolation features to cpusets.

Thanks.

#11 lore raw

Re: [PATCH 3/3] sched: Spare idle load balancing on nohz_full CPUs

In reply to Rik van Riel
Quoted 42 lines · Rik van Riel
Quoted 36 lines · Frederic Weisbecker

Although idle load balancing obviously only concern idle CPUs, it can be a disturbance on a busy nohz_full CPU. Indeed a CPU can only get rid
of an idle load balancing duty once a tick fires while it runs a task and this can take a while in a nohz_full CPU.

We could fix that and escape the idle load balancing duty from the very
idle exit path but that would bring unecessary overhead. Lets just not
bother and leave that job to housekeeping CPUs (those outside nohz_full
range). The nohz_full CPUs simply don't want any disturbance.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Peter Zijlstra <[email protected]>

---
 kernel/sched/fair.c | 4 ++++

 1 file changed, 4 insertions(+)
kernel/sched/fair.c +0 -0
index d711093..cfca960 100644
@@ -8659,6 +8659,10 @@ void nohz_balance_enter_idle(int cpu)
  	if (!cpu_active(cpu))
  		return;

kernel/sched/fair.c +1 -0
+	/* Spare idle load balancing on CPUs that don't want to be

disturbed */

kernel/sched/fair.c +3 -0
+	if (!is_housekeeping_cpu(cpu))
+		return;
+
Quoted 2 lines

  if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu))) return;

I am not entirely convinced on this one.

Quoted 2 lines

Doesn't the if (on_null_domain(cpu_rq(cpu)) test
a few lines down take care of this already?

It shouldn't, since nohz_full= doesn't imply isolcpus= anymore. Of course it does if the user manually adds them.

Quoted 4 lines

Do we want nohz_full to always automatically
imply that no idle balancing will happen, like
on isolated CPUs?

You're making a good point in that I would prefer that nohz_full be only about the tick and let some sort of separate isolation subsystem deal with individual isolation features: nohz, workqueues, idle load balancing, etc...

That's why I rather used is_housekeeping_cpu() and not !tick_nohz_full_cpu() because for now housekeepers are ~tick_nohz_full_mask but later it should be cpu_possible_mask by default or some given set of CPUs defined by the future isolation subsystem.

Thanks.

#12 lore raw

[tip:sched/core] sched/fair: Spare idle load balancing on nohz_full CPUs

In reply to Frederic Weisbecker
sched/fair: Spare idle load balancing on nohz_full CPUs
Commit-ID:  387bc8b5536eeb0a92f4b4ab553539eaea2ac0ba
Gitweb:     http://git.kernel.org/tip/387bc8b5536eeb0a92f4b4ab553539eaea2ac0ba
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Mon, 19 Jun 2017 04:12:02 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 22 Jun 2017 11:30:02 +0200

sched/fair: Spare idle load balancing on nohz_full CPUs

Although idle load balancing obviously only concerns idle CPUs, it can be a disturbance on a busy nohz_full CPU. Indeed a CPU can only get rid of an idle load balancing duty once a tick fires while it runs a task and this can take a while on a nohz_full CPU.

We could fix that and escape the idle load balancing duty from the very idle exit path but that would bring unecessary overhead. Lets just not bother and leave that job to housekeeping CPUs (those outside nohz_full range). The nohz_full CPUs simply don't want any disturbance.

---
 kernel/sched/fair.c | 4 ++++
 1 file changed, 4 insertions(+)
kernel/sched/fair.c +4 -0
index a24661a..694c258 100644
@@ -8683,6 +8683,10 @@ void nohz_balance_enter_idle(int cpu)
 	if (!cpu_active(cpu))
 		return;
 
+	/* Spare idle load balancing on CPUs that don't want to be disturbed: */
+	if (!is_housekeeping_cpu(cpu))
+		return;
+
 	if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
 		return;
 
#13 lore raw

Re: [tip:sched/core] sched/fair: Spare idle load balancing on nohz_full CPUs

Hi Ingo,

Quoted 8 lines · tip-bot for Frederic Weisbecker
Commit-ID:  387bc8b5536eeb0a92f4b4ab553539eaea2ac0ba
Gitweb:     http://git.kernel.org/tip/387bc8b5536eeb0a92f4b4ab553539eaea2ac0ba
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Mon, 19 Jun 2017 04:12:02 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 22 Jun 2017 11:30:02 +0200

sched/fair: Spare idle load balancing on nohz_full CPUs

Thanks for applying the series! The two other patches are indeed good but Rik and Mike have mitigated feelings about this very patch. I think we need to decouple housekeeping from nohz_full before applying it. Is it possible to set it aside for now?

Thanks!

maintainer
#14 lore raw

Re: [tip:sched/core] sched/fair: Spare idle load balancing on nohz_full CPUs

Quoted 10 lines · Frederic Weisbecker

Hi Ingo,

Quoted 7 lines · tip-bot for Frederic Weisbecker
Commit-ID:  387bc8b5536eeb0a92f4b4ab553539eaea2ac0ba
Gitweb:     http://git.kernel.org/tip/387bc8b5536eeb0a92f4b4ab553539eaea2ac0ba
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Mon, 19 Jun 2017 04:12:02 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 22 Jun 2017 11:30:02 +0200
Quoted 6 lines
Quoted 1 line

sched/fair: Spare idle load balancing on nohz_full CPUs

Thanks for applying the series! The two other patches are indeed good but Rik and Mike have mitigated feelings about this very patch. I think we need to decouple housekeeping from nohz_full before applying it. Is it possible to set it aside for now?

Well, if patches are forthcoming and the commit isn't buggy per se, we could have it with the note of it being improved further.

Thanks,

Ingo