Skip to contentSkip to conversation

cpuset: Don't pass empty cpumasks to partition_sched_domains()

PATCH In review Lai Jiangshan 2 participants 2 messages Jul 16, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 cpuset: Don't pass empty cpumasks to partition_sched_domains()

i create a lots of empty cpusets(empty cpumasks) and turn off the "sched_load_balance" in top cpuset.

And i found that all these empty cpumasks are passed to partition_sched_domains() in rebuild_sched_domains(), it's very time-consuming for partition_sched_domains() and it's not need.

It also reduce memory consumed and some works in
rebuild_sched_domains() too.

---

kernel/cpuset.c +5 -0
index 798b3ab..1fbd52c 100644
@@ -609,8 +609,13 @@ static void rebuild_sched_domains(void)
 	while (__kfifo_get(q, (void *)&cp, sizeof(cp))) {
 		struct cgroup *cont;
 		struct cpuset *child;   /* scans child cpusets of cp */
+
+		if (cpus_empty(cp->cpus_allowed))
+			continue;
+
 		if (is_sched_load_balance(cp))
 			csa[csn++] = cp;
+
 		list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
 			child = cgroup_cs(cont);
 			__kfifo_put(q, (void *)&child, sizeof(cp));
Acked-by on v1 1/3
#1 lore raw
Quoted 8 lines · Lai Jiangshan

i create a lots of empty cpusets(empty cpumasks) and turn off the "sched_load_balance" in top cpuset.

And i found that all these empty cpumasks are passed to partition_sched_domains() in rebuild_sched_domains(), it's very time-consuming for partition_sched_domains() and it's not need.

Quoted 4 lines

It also reduce memory consumed and some works in
rebuild_sched_domains() too.

Seems reasonable, and I don't think that it clashes with the other outstanding rebuild_sched_domains() patches.

Paul