Skip to contentSkip to conversation

sched: Allow for overlapping sched_domain spans

tip:sched/urgent tip-bot for Peter Zijlstra 1 participant 1 message Jul 20, 2011 Scheduler

lore
Share & tools
lore
#0 lore raw
Commit-ID:  e3589f6c81e4764d32a25d2a2a0afe54fa344f5c
Gitweb:     http://git.kernel.org/tip/e3589f6c81e4764d32a25d2a2a0afe54fa344f5c
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Fri, 15 Jul 2011 10:35:52 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 20 Jul 2011 18:32:41 +0200

sched: Allow for overlapping sched_domain spans

Allow for sched_domain spans that overlap by giving such domains their own sched_group list instead of sharing the sched_groups amongst each-other.

This is needed for machines with more than 16 nodes, because sched_domain_node_span() will generate a node mask from the 16 nearest nodes without regard if these masks have any overlap.

Currently sched_domains have a sched_group that maps to their child sched_domain span, and since there is no overlap we share the sched_group between the sched_domains of the various CPUs. If however there is overlap, we would need to link the sched_group list in different ways for each cpu, and hence sharing isn't possible.

In order to solve this, allocate private sched_groups for each CPU's sched_domain but have the sched_groups share a sched_group_power structure such that we can uniquely track the power.

---
 include/linux/sched.h   |    2 +
 kernel/sched.c          |  157 ++++++++++++++++++++++++++++++++++++++---------
 kernel/sched_features.h |    2 +
 3 files changed, 132 insertions(+), 29 deletions(-)
include/linux/sched.h +2 -0
index 2e5b3c8..bde99d5 100644
@@ -844,6 +844,7 @@ enum cpu_idle_type {
 #define SD_SERIALIZE		0x0400	/* Only a single load balancing instance */
 #define SD_ASYM_PACKING		0x0800  /* Place busy groups earlier in the domain */
 #define SD_PREFER_SIBLING	0x1000	/* Prefer to place tasks in a sibling domain */
+#define SD_OVERLAP		0x2000	/* sched_domains of this level overlap */
 
 enum powersavings_balance_level {
 	POWERSAVINGS_BALANCE_NONE = 0,  /* No power saving load balance */
@@ -894,6 +895,7 @@ static inline int sd_power_saving_flags(void)
 }
 
 struct sched_group_power {
+	atomic_t ref;
 	/*
 	 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
 	 * single CPU.
kernel/sched.c +128 -29

251 lines not on this page · raw message

kernel/sched_features.h +2 -0
index be40f73..1e7066d 100644
@@ -70,3 +70,5 @@ SCHED_FEAT(NONIRQ_POWER, 1)
  * using the scheduler IPI. Reduces rq->lock contention/bounces.
  */
 SCHED_FEAT(TTWU_QUEUE, 1)
+
+SCHED_FEAT(FORCE_SD_OVERLAP, 0)