linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] sched/topology, cpuset: Account for housekeeping CPUs to avoid empty cpumasks
@ 2019-11-04  0:39 Valentin Schneider
  2019-11-04  0:47 ` Valentin Schneider
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Valentin Schneider @ 2019-11-04  0:39 UTC (permalink / raw)
  To: linux-kernel, cgroups
  Cc: lizefan, tj, hannes, mingo, peterz, vincent.guittot,
	Dietmar.Eggemann, morten.rasmussen, qperret, Michal Koutný

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ý <mkoutny@suse.com>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 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


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

end of thread, other threads:[~2019-11-15 18:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04  0:39 [PATCH v2] sched/topology, cpuset: Account for housekeeping CPUs to avoid empty cpumasks Valentin Schneider
2019-11-04  0:47 ` Valentin Schneider
2019-11-14 16:03 ` Valentin Schneider
2019-11-15 17:18   ` Michal Koutný
2019-11-15 18:48     ` Valentin Schneider
2019-11-15 18:13 ` [tip: sched/urgent] " tip-bot2 for Valentin Schneider
2019-11-15 18:15   ` Valentin Schneider

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).