Skip to contentSkip to conversation

sched/fair: Move update_nohz_stats() under CONFIG_NO_HZ_COMMON

PATCH In review Kefeng Wang 2 participants 3 messages Mar 30, 2021 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/fair: Move update_nohz_stats() under CONFIG_NO_HZ_COMMON

update_nohz_stats() only call _nohz_idle_balance() under CONFIG_NO_HZ_COMMON.

---
 kernel/sched/fair.c | 40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)
kernel/sched/fair.c +18 -22
index 6d73bdbb2d40..2a20ada83cbb 100644
@@ -8395,28 +8395,6 @@ group_type group_classify(unsigned int imbalance_pct,
 	return group_has_spare;
 }
 
-static bool update_nohz_stats(struct rq *rq)
-{
-#ifdef CONFIG_NO_HZ_COMMON
-	unsigned int cpu = rq->cpu;
-
-	if (!rq->has_blocked_load)
-		return false;
-
-	if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask))
-		return false;
-
-	if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick)))
-		return true;
-
-	update_blocked_averages(cpu);
-
-	return rq->has_blocked_load;
-#else
-	return false;
-#endif
-}
-
 /**
  * update_sg_lb_stats - Update sched_group's statistics for load balancing.
  * @env: The load balancing environment.
@@ -10380,6 +10358,24 @@ void nohz_balance_enter_idle(int cpu)
 	WRITE_ONCE(nohz.has_blocked, 1);
 }
 
+static bool update_nohz_stats(struct rq *rq)
+{
+	unsigned int cpu = rq->cpu;
+
+	if (!rq->has_blocked_load)
+		return false;
+
+	if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask))
+		return false;
+
+	if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick)))
+		return true;
+
+	update_blocked_averages(cpu);
+
+	return rq->has_blocked_load;
+}
+
 /*
  * Internal function that runs load balance for all idle cpus. The load balance
  * can be a simple update of blocked load or a complete load balance with
Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 2 lines · Kefeng Wang

update_nohz_stats() only call _nohz_idle_balance() under CONFIG_NO_HZ_COMMON.

a similar patch has already been sent and reviewed :
[email protected]

Quoted 67 lines
---
 kernel/sched/fair.c | 40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)
kernel/sched/fair.c +18 -23
index 6d73bdbb2d40..2a20ada83cbb 100644
@@ -8395,28 +8395,6 @@ group_type group_classify(unsigned int imbalance_pct,
        return group_has_spare;
 }
 
-static bool update_nohz_stats(struct rq *rq)
-{
-#ifdef CONFIG_NO_HZ_COMMON
-       unsigned int cpu = rq->cpu;
-
-       if (!rq->has_blocked_load)
-               return false;
-
-       if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask))
-               return false;
-
-       if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick)))
-               return true;
-
-       update_blocked_averages(cpu);
-
-       return rq->has_blocked_load;
-#else
-       return false;
-#endif
-}
-
 /**
  * update_sg_lb_stats - Update sched_group's statistics for load balancing.
  * @env: The load balancing environment.
@@ -10380,6 +10358,24 @@ void nohz_balance_enter_idle(int cpu)
        WRITE_ONCE(nohz.has_blocked, 1);
 }
 
+static bool update_nohz_stats(struct rq *rq)
+{
+       unsigned int cpu = rq->cpu;
+
+       if (!rq->has_blocked_load)
+               return false;
+
+       if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask))
+               return false;
+
+       if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick)))
+               return true;
+
+       update_blocked_averages(cpu);
+
+       return rq->has_blocked_load;
+}
+
 /*
  * Internal function that runs load balance for all idle cpus. The load balance
  * can be a simple update of blocked load or a complete load balance with
--

2.26.2

#2 lore raw
Quoted 4 lines · Vincent Guittot
Quoted 1 line · Kefeng Wang

update_nohz_stats() only call _nohz_idle_balance() under CONFIG_NO_HZ_COMMON.

a similar patch has already been sent and reviewed :
[email protected]

ok please ignore it.