* [PATCH] sched/fair: Correct CPU selection from isolated domain
@ 2024-07-30 7:59 wujing
0 siblings, 0 replies; 6+ messages in thread
From: wujing @ 2024-07-30 7:59 UTC (permalink / raw)
To: mingo, peterz; +Cc: linux-kernel, dongml2, wujing, wujing, QiLiang Yuan
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
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.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [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; 6+ 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] 6+ messages in thread* Re: [PATCH] sched/fair: Correct CPU selection from isolated domain
2025-01-06 9:26 wujing
@ 2025-01-06 9:51 ` Greg KH
0 siblings, 0 replies; 6+ 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] 6+ messages in thread
* [PATCH] sched/fair: Correct CPU selection from isolated domain
@ 2024-07-30 7:10 wujing
2024-07-30 8:22 ` Peter Zijlstra
2024-07-30 9:02 ` zhengzucheng
0 siblings, 2 replies; 6+ messages in thread
From: wujing @ 2024-07-30 7:10 UTC (permalink / raw)
To: mingo, peterz; +Cc: linux-kernel, dongml2, wujing, QiLiang Yuan
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
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.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] sched/fair: Correct CPU selection from isolated domain
2024-07-30 7:10 wujing
@ 2024-07-30 8:22 ` Peter Zijlstra
2024-07-30 9:02 ` zhengzucheng
1 sibling, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2024-07-30 8:22 UTC (permalink / raw)
To: wujing; +Cc: mingo, linux-kernel, dongml2, QiLiang Yuan
On Tue, Jul 30, 2024 at 03:10:50PM +0800, wujing wrote:
> 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
If you're trying to backport something, I think you forgot to Cc stable
and provide the proper upstream commit.
As is this isn't something I can do anything with. The patch does not
apply to any recent kernel and AFAICT this issue has long since been
fixed.
>
> 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.45.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sched/fair: Correct CPU selection from isolated domain
2024-07-30 7:10 wujing
2024-07-30 8:22 ` Peter Zijlstra
@ 2024-07-30 9:02 ` zhengzucheng
1 sibling, 0 replies; 6+ messages in thread
From: zhengzucheng @ 2024-07-30 9:02 UTC (permalink / raw)
To: wujing, mingo, peterz; +Cc: linux-kernel, dongml2, QiLiang Yuan
it has already been addressed by the following patches in tip/sched/core:
8aeaffef8c6e ("sched/fair: Take the scheduling domain into account in
select_idle_smt()")
23d04d8c6b8e ("sched/fair: Take the scheduling domain into account in
select_idle_core()")
在 2024/7/30 15:10, wujing 写道:
> 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
>
> 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;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-06 9:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30 7:59 [PATCH] sched/fair: Correct CPU selection from isolated domain wujing
-- strict thread matches above, loose matches on Subject: below --
2025-01-06 9:26 wujing
2025-01-06 9:51 ` Greg KH
2024-07-30 7:10 wujing
2024-07-30 8:22 ` Peter Zijlstra
2024-07-30 9:02 ` zhengzucheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox