[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250226024741.2274-1-xuewen.yan@unisoc.com>
Date: Wed, 26 Feb 2025 10:47:41 +0800
From: Xuewen Yan <xuewen.yan@...soc.com>
To: <peterz@...radead.org>, <vincent.guittot@...aro.org>, <mingo@...hat.com>,
<juri.lelli@...hat.com>, <dietmar.eggemann@....com>
CC: <rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
<vschneid@...hat.com>, <ke.wang@...soc.com>, <di.shen@...soc.com>,
<xuewen.yan94@...il.com>, <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH] sched/fair: Fixup wake_up_sync vs DELAYED_DEQUEUE
Delayed dequeued feature keeps a sleeping task enqueued until its
lag has elapsed. As a result, it stays also visible in rq->nr_running.
So when in ake_affine_idle(), we should use the real running-tasks
in rq to check whether we should place the wake-up task to
current cpu.
Fixes: 152e11f6df29 ("sched/fair: Implement delayed dequeue")
Signed-off-by: Xuewen Yan <xuewen.yan@...soc.com>
---
kernel/sched/fair.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1c0ef435a7aa..2d6d5582c3e9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7342,8 +7342,15 @@ wake_affine_idle(int this_cpu, int prev_cpu, int sync)
if (available_idle_cpu(this_cpu) && cpus_share_cache(this_cpu, prev_cpu))
return available_idle_cpu(prev_cpu) ? prev_cpu : this_cpu;
- if (sync && cpu_rq(this_cpu)->nr_running == 1)
- return this_cpu;
+ if (sync) {
+ struct rq *rq = cpu_rq(this_cpu);
+ int nr_delayed;
+
+ nr_delayed = rq->cfs.h_nr_queued - rq->cfs.h_nr_runnable;
+
+ if ((rq->nr_running - nr_delayed) == 1)
+ return this_cpu;
+ }
if (available_idle_cpu(prev_cpu))
return prev_cpu;
--
2.25.1
Powered by blists - more mailing lists