summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/cpuset.h1
-rw-r--r--kernel/sched/fair.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index a67ba1b32d16..914983387e95 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -279,6 +279,7 @@ static inline void dl_rebuild_rd_accounting(void)
static inline void rebuild_sched_domains(void)
{
+ guard(cpus_read_lock)();
partition_sched_domains(1, NULL, NULL);
}
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 001140132a7d..6d881e530f89 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4934,7 +4934,12 @@ static int tg_cpus(struct task_group *tg)
nr = cpuset_num_cpus(cgrp);
}
- return nr;
+ /*
+ * An empty cpuset would propagate a 0 shares_max into
+ * __calc_smp_shares(), where clamp() yields hi when hi < lo and so
+ * defeats the MIN_SHARES floor. Match tg_tasks(), which floors at 1.
+ */
+ return max(nr, 1);
}
static inline int tg_tasks(struct task_group *tg)