Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5558395imm; Mon, 23 Jul 2018 01:42:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcjLZD1PYjeaCtFdfQ9zNmCVQixxaERoSLvzIkIgN6A2jx6AI9b3nzIyU/Az3j7G8xBmoCg X-Received: by 2002:a63:375b:: with SMTP id g27-v6mr11507460pgn.59.1532335363487; Mon, 23 Jul 2018 01:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532335363; cv=none; d=google.com; s=arc-20160816; b=Oa0Ljr5zfSnPpjRx9R4S9bytODbkkZZgRzVDjuKa9yq1U/jUYK3MjfeNke6aRJsy8k t3zp3O8r+Ngldvy51aXQnt0xOO57NVjMZ//OeK29jNvyXS+7vraUUL6kE9GrVnzXHd1G j39Lqbdg7QAvyXdmWAKMKSuGBwsvVvODY4/q0/jxbzf2lRkPfeYPv1bBsCWctIXGxwLb PoDMhitr+PKMPde4bzsaVBWjZWgaaRb2532MNo1bmH76tRCa6CZwSDfqEHfEY2OKrHRN fwlocWn2SyOeHG6qysIxrzZsPAyvH0sSWFatkV2L/tl6Tm/YGOLQwuxH+cYQO4yPssN8 dKRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Aae0eJ4rAQ/c4ZYMPvwCCAGNoI3zU8R2l0dhohlyaAc=; b=y+81yvtZPX294eZF7KgqNlyZ4PfOX6J8zMtowtAKgGA5totNouvnV5VzlWdGoEIClT pORscHgbkUDkCHoiK0XvX8oFXtUwIwlQVB6USDtnvHorb3sB6OSv1Paqf5yKesHsJhDC FwudBppx3jlPuUwNfQ7dvrILgzcmyY4PggdYxShwaEfLXjmxH6YsfqEzC0qCEOm3C1oB lP41fquiqW4aalAoM/7ZZagSfOs7aMyrprYsF/5/T6QNtLr7IndtL2qtpdos1HMYJeLg cGStmW/wSzjurmo/sJATQGgDco+qlTTyMHxS7kn8X1lb9E+qa5eiL05nOo0+XrgQyAJ1 Ljrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=p9BOGgb8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c16-v6si7408366pgw.460.2018.07.23.01.42.28; Mon, 23 Jul 2018 01:42:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=p9BOGgb8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388085AbeGWJkk (ORCPT + 99 others); Mon, 23 Jul 2018 05:40:40 -0400 Received: from merlin.infradead.org ([205.233.59.134]:36844 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387869AbeGWJkj (ORCPT ); Mon, 23 Jul 2018 05:40:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Aae0eJ4rAQ/c4ZYMPvwCCAGNoI3zU8R2l0dhohlyaAc=; b=p9BOGgb8pY+GjftD51S/VwqOd 798v53T8CMw2gGmrjuo9uyHjXbC3v5FWp+AbJArI6b2r+tznxhxKmBeygTb1Eok8E9SN4o9smN0RV +sU0B9K+MRVbA+awcPYDBkHMqF31xkroHRkog+PlyCpzpDqE2LYm/P7IzidrkrV5CloItgWB4wlDB ViMdbBgee3SLu7MH06bBFZmxxpt4HCcnEzeTJK4hrBJ8+oWkMyGkgOzufi+h1UVvScGwEnz7Zmg3+ VHpAMg0I5izwY9g6A0wtlDTLmMK1l5JdUexTNZalRSos9xMrC+lzfmPlHoJsRDNUC4mVPZCBBirXB qLbHxgbRw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhWOO-0004sT-Hh; Mon, 23 Jul 2018 08:40:33 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 42A3420275F47; Mon, 23 Jul 2018 10:40:31 +0200 (CEST) Date: Mon, 23 Jul 2018 10:40:31 +0200 From: Peter Zijlstra To: Chen Lin 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 , Tan Hu Subject: Re: [PATCH] sched/numa: do not balance tasks onto isolated cpus Message-ID: <20180723084031.GX2494@hirez.programming.kicks-ass.net> References: <1532324370-80651-1-git-send-email-chen.lin130@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1532324370-80651-1-git-send-email-chen.lin130@zte.com.cn> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 23, 2018 at 01:39:30PM +0800, Chen Lin wrote: > From: Chen Lin > > 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 > Signed-off-by: Tan Hu > Signed-off-by: Jiang Biao 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 >