mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Chen Lin <chen.lin130@zte.com.cn>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org,
	jiang.biao2@zte.com.cn, zhong.weidong@zte.com.cn,
	tan.hu@zte.com.cn.cn, Chen Lin <cheng.lin130@zte.com.cn>,
	Tan Hu <tan.hu@zte.com.cn>
Subject: Re: [PATCH] sched/numa: do not balance tasks onto isolated cpus
Date: Mon, 23 Jul 2018 10:40:31 +0200	[thread overview]
Message-ID: <20180723084031.GX2494@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1532324370-80651-1-git-send-email-chen.lin130@zte.com.cn>

On Mon, Jul 23, 2018 at 01:39:30PM +0800, Chen Lin wrote:
> From: Chen Lin <cheng.lin130@zte.com.cn>
> 
> NUMA balancing has not taken *isolcpus(isolated cpus)* into 
> consideration. It may migrate tasks onto isolated cpus and the 
> migrated tasks will never escape from the isolated cpus, which will
> break the isolation provided by *isolcpus* boot parameter and 
> intrduce various problems.
> 
> This patch ensure NUMA balancing not to balance tasks onto iaolated
> cpus. 

I'm not sure what kernel you're patching, but cpu_isolated_map doesn't
exist anymore. Also, if it steps on isolated CPUs, this is the wrong fix
anyway. Load-balancing should be constrained to the current root domain.

> Signed-off-by: Cheng Lin <cheng.lin130@zte.com.cn>
> Signed-off-by: Tan Hu <tan.hu@zte.com.cn>
> Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>

This SoB chain is invalid.

> ---
>  kernel/sched/core.c | 9 ++++++---
>  kernel/sched/fair.c | 3 ++-
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index fe365c9..f9ce90c 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1302,10 +1302,12 @@ int migrate_swap(struct task_struct *cur, struct task_struct *p)
>  	if (!cpu_active(arg.src_cpu) || !cpu_active(arg.dst_cpu))
>  		goto out;
> 
> -	if (!cpumask_test_cpu(arg.dst_cpu, &arg.src_task->cpus_allowed))
> +	if ((!cpumask_test_cpu(arg.dst_cpu, &arg.src_task->cpus_allowed))
> +            || cpumask_test_cpu(arg.dst_cpu, cpu_isolated_map))
>  		goto out;
> 
> -	if (!cpumask_test_cpu(arg.src_cpu, &arg.dst_task->cpus_allowed))
> +	if ((!cpumask_test_cpu(arg.src_cpu, &arg.dst_task->cpus_allowed))
> +            || cpumask_test_cpu(arg.src_cpu, cpu_isolated_map))
>  		goto out;
> 
>  	trace_sched_swap_numa(cur, arg.src_cpu, p, arg.dst_cpu);
> @@ -5508,7 +5510,8 @@ int migrate_task_to(struct task_struct *p, int target_cpu)
>  	if (curr_cpu == target_cpu)
>  		return 0;
> 
> -	if (!cpumask_test_cpu(target_cpu, &p->cpus_allowed))
> +	if ((!cpumask_test_cpu(target_cpu, &p->cpus_allowed))
> +            || cpumask_test_cpu(target_cpu, cpu_isolated_map))
>  		return -EINVAL;
> 
>  	/* TODO: This is not properly updating schedstats */
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 2f0a0be..a91f8fe 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1724,7 +1724,8 @@ static void task_numa_find_cpu(struct task_numa_env *env,
> 
>  	for_each_cpu(cpu, cpumask_of_node(env->dst_nid)) {
>  		/* Skip this CPU if the source task cannot migrate */
> -		if (!cpumask_test_cpu(cpu, &env->p->cpus_allowed))
> +		if ((!cpumask_test_cpu(cpu, &env->p->cpus_allowed))
> +                    || cpumask_test_cpu(cpu, cpu_isolated_map))
>  			continue;
> 
>  		env->dst_cpu = cpu;
> --
> 1.8.3.1
> 

  reply	other threads:[~2018-07-23  8:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23  5:39 Chen Lin
2018-07-23  8:40 ` Peter Zijlstra [this message]
2018-07-24  1:11   ` jiang.biao2
2018-07-24  9:06     ` Peter Zijlstra
2018-07-25  0:30       ` jiang.biao2
2018-07-25  8:35         ` Peter Zijlstra
2018-07-25  8:52           ` jiang.biao2
2018-07-23 20:06 ` kbuild test robot
2018-07-23 20:06 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180723084031.GX2494@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=chen.lin130@zte.com.cn \
    --cc=cheng.lin130@zte.com.cn \
    --cc=jiang.biao2@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tan.hu@zte.com.cn \
    --cc=tan.hu@zte.com.cn.cn \
    --cc=zhong.weidong@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®