Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3345842ybx; Sun, 3 Nov 2019 16:41:58 -0800 (PST) X-Google-Smtp-Source: APXvYqzGdiv+ME7rybCD+AyCu0dzRI0rFskAF8T91Zy0DeR5IqWT20A8RoqDOUr2nuaLNovSLODJ X-Received: by 2002:a50:950a:: with SMTP id u10mr26910420eda.68.1572828118375; Sun, 03 Nov 2019 16:41:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572828118; cv=none; d=google.com; s=arc-20160816; b=usiZCgTZJywdHhMNeR83RsLrmzqTzsTRucvB3jt7GnP7erFXsBbaEPAscKHVtKwFbp wF6v2FuEOIPTQ53oUugfXP4h4I/k0M1zZRpkFoMKuDgutB45j/rPRrT8Ms+ZsNgsnCFY x3p7c8VxHRNaoV0bqHOMYNrgHbJ4g8dHwO780W5FcnlQFoe9NNrro6QSTKk8c2mZJ5pa fGEAu1veYhmCAng/wnIw+tuvCYuhDJp/RA/+u1FFHcIA44LRh9r6QqOk/XlUHc0wWAfW 65LiVa/3j455HjaZeNu+73ImzOgQ61qBMT2uEd8sfnVFzw+U4GqVS1zcOvl8kDysewAB bxjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GCABEC04eLafkxVElVOuX7QSTbQxKoL6NQf1VV7SlhI=; b=0sYs/W0ONFlnCe7H6XMXzfyeXcq48fYH0opDT4o/FH3PsAfYLncGBvH3MHlHVGtXDJ UogBUp/0c7dI1cksFTCx/cM+ztUqVJ2w2gfBz/m1Iny8i4y1DoJvMjfFSIQSqHEhPgBG QbTcbBuwjpOdABwhOxFc5Uap0U+2Joj28hZbzZ82KXv7jTjzNz8QR279iNPrBOxnaBrZ T5O/D594ommAGlIC1IufeMdWATwumjKBi/T3J4oiUpur2tIOB3pVVsbgw+UwcHgloqDm shmpPpptNDFQheDsiwHtzGpsAQmDBIyiINh+qW2DBIuBcdtzDHmJns1bsLHz8/U61nLV cFjA== ARC-Authentication-Results: i=1; mx.google.com; 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 hk1si10410124ejb.408.2019.11.03.16.41.34; Sun, 03 Nov 2019 16:41:58 -0800 (PST) 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; 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 S1728432AbfKDAj3 (ORCPT + 99 others); Sun, 3 Nov 2019 19:39:29 -0500 Received: from foss.arm.com ([217.140.110.172]:33428 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728189AbfKDAj3 (ORCPT ); Sun, 3 Nov 2019 19:39:29 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6663A1FB; Sun, 3 Nov 2019 16:39:28 -0800 (PST) Received: from e113632-lin.cambridge.arm.com (e113632-lin.cambridge.arm.com [10.1.194.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B33263F67D; Sun, 3 Nov 2019 16:39:26 -0800 (PST) From: Valentin Schneider To: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Cc: lizefan@huawei.com, tj@kernel.org, hannes@cmpxchg.org, mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, Dietmar.Eggemann@arm.com, morten.rasmussen@arm.com, qperret@google.com, =?UTF-8?q?Michal=20Koutn=C3=BD?= Subject: [PATCH v2] sched/topology, cpuset: Account for housekeeping CPUs to avoid empty cpumasks Date: Mon, 4 Nov 2019 00:39:06 +0000 Message-Id: <20191104003906.31476-1-valentin.schneider@arm.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michal noted that a cpuset's effective_cpus can be a non-empy mask, but because of the masking done with housekeeping_cpumask(HK_FLAG_DOMAIN) further down the line, we can still end up with an empty cpumask being passed down to partition_sched_domains_locked(). Do the proper thing and don't just check the mask is non-empty - check that its intersection with housekeeping_cpumask(HK_FLAG_DOMAIN) is non-empty. Fixes: cd1cb3350561 ("sched/topology: Don't try to build empty sched domains") Reported-by: Michal Koutný Signed-off-by: Valentin Schneider --- kernel/cgroup/cpuset.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index c87ee6412b36..e4c10785dc7c 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -798,8 +798,14 @@ static int generate_sched_domains(cpumask_var_t **domains, cpumask_subset(cp->cpus_allowed, top_cpuset.effective_cpus)) continue; + /* + * Skip cpusets that would lead to an empty sched domain. + * That could be because effective_cpus is empty, or because + * it's only spanning CPUs outside the housekeeping mask. + */ if (is_sched_load_balance(cp) && - !cpumask_empty(cp->effective_cpus)) + cpumask_intersects(cp->effective_cpus, + housekeeping_cpumask(HK_FLAG_DOMAIN))) csa[csn++] = cp; /* skip @cp's subtree if not a partition root */ -- 2.22.0