mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Remove sd->nohz_idle
@ 2026-02-27 16:47 Vincent Guittot
  2026-02-27 17:32 ` K Prateek Nayak
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Guittot @ 2026-02-27 16:47 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, dietmar.eggemann, rostedt, bsegall,
	mgorman, vschneid, linux-kernel, kprateek.nayak
  Cc: Vincent Guittot

sd->nohz_idle is used to call once inc|dec of &sd->shared->nr_busy_cpus
when entering or leaving idle state but the call to
set_cpu_sd_state_idle|busy is already protected by rq->nohz_tick_stopped
being already set or clear.

Remove the useless sd->nohz_idle field which equals !rq->nohz_tick_stopped.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
 include/linux/sched/topology.h |  1 -
 kernel/sched/fair.c            | 16 ++++------------
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index a1e1032426dc..59e498006072 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -82,7 +82,6 @@ struct sched_domain {
 	unsigned int cache_nice_tries;	/* Leave cache hot tasks for # tries */
 	unsigned int imb_numa_nr;	/* Nr running tasks that allows a NUMA imbalance */
 
-	int nohz_idle;			/* NOHZ IDLE status */
 	int flags;			/* See SD_* */
 	int level;
 
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d57c02e82f3a..888875e91073 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12818,12 +12818,8 @@ static void set_cpu_sd_state_busy(int cpu)
 	rcu_read_lock();
 	sd = rcu_dereference_all(per_cpu(sd_llc, cpu));
 
-	if (!sd || !sd->nohz_idle)
-		goto unlock;
-	sd->nohz_idle = 0;
-
-	atomic_inc(&sd->shared->nr_busy_cpus);
-unlock:
+	if (likely(sd))
+		atomic_inc(&sd->shared->nr_busy_cpus);
 	rcu_read_unlock();
 }
 
@@ -12847,12 +12843,8 @@ static void set_cpu_sd_state_idle(int cpu)
 	rcu_read_lock();
 	sd = rcu_dereference_all(per_cpu(sd_llc, cpu));
 
-	if (!sd || sd->nohz_idle)
-		goto unlock;
-	sd->nohz_idle = 1;
-
-	atomic_dec(&sd->shared->nr_busy_cpus);
-unlock:
+	if (likely(sd))
+		atomic_dec(&sd->shared->nr_busy_cpus);
 	rcu_read_unlock();
 }
 
-- 
2.43.0


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

end of thread, other threads:[~2026-03-03 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-27 16:47 [PATCH] sched/fair: Remove sd->nohz_idle Vincent Guittot
2026-02-27 17:32 ` K Prateek Nayak
2026-03-03 15:00   ` Vincent Guittot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®