public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Correct CPU selection from isolated domain
@ 2025-01-06  9:26 wujing
  2025-01-06  9:51 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: wujing @ 2025-01-06  9:26 UTC (permalink / raw)
  To: gregkh, sasha.levin
  Cc: mingo, peterz, linux-kernel, stable, wujing, wujing, QiLiang Yuan

From: wujing <realwujing@gmail.com>

We encountered an issue where the kernel thread `ksmd` runs on the PMD
dedicated isolated core, leading to high latency in OVS packets.

Upon analysis, we discovered that this is caused by the current
select_idle_smt() function not taking the sched_domain mask into account.

Kernel version: linux-4.19.y

Cc: stable@vger.kernel.org # 4.19.x
Signed-off-by: wujing <realwujing@qq.com>
Signed-off-by: QiLiang Yuan <yuanql9@chinatelecom.cn>
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 09f82c84474b..0950cabfc1d0 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6171,7 +6171,8 @@ static int select_idle_smt(struct task_struct *p, struct sched_domain *sd, int t
 		return -1;
 
 	for_each_cpu(cpu, cpu_smt_mask(target)) {
-		if (!cpumask_test_cpu(cpu, &p->cpus_allowed))
+		if (!cpumask_test_cpu(cpu, &p->cpus_allowed) ||
+			!cpumask_test_cpu(cpu, sched_domain_span(sd)))
 			continue;
 		if (available_idle_cpu(cpu))
 			return cpu;
-- 
2.39.5


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

* Re: [PATCH] sched/fair: Correct CPU selection from isolated domain
  2025-01-06  9:26 [PATCH] sched/fair: Correct CPU selection from isolated domain wujing
@ 2025-01-06  9:51 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2025-01-06  9:51 UTC (permalink / raw)
  To: wujing
  Cc: sasha.levin, mingo, peterz, linux-kernel, stable, wujing,
	QiLiang Yuan

On Mon, Jan 06, 2025 at 05:26:34PM +0800, wujing wrote:
> From: wujing <realwujing@gmail.com>
> 
> We encountered an issue where the kernel thread `ksmd` runs on the PMD
> dedicated isolated core, leading to high latency in OVS packets.
> 
> Upon analysis, we discovered that this is caused by the current
> select_idle_smt() function not taking the sched_domain mask into account.
> 
> Kernel version: linux-4.19.y

You do know that 4.19.y is long end-of-life and totally insecure and
nothing that you should be using in anything, right?  Please move to a
more modern kernel version.

good luck!

greg k-h

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

end of thread, other threads:[~2025-01-06  9:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-06  9:26 [PATCH] sched/fair: Correct CPU selection from isolated domain wujing
2025-01-06  9:51 ` Greg KH

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