[PATCH v5 11/17] sched/topology: Mark SD_PREFER_SIBLING as SDF_NEEDS_GROUPS

From: Valentin Schneider
Date: Wed Aug 12 2020 - 08:53:38 EST


SD_PREFER_SIBLING is currently considered in sd_parent_degenerate() but not
in sd_degenerate(). It too hinges on load balancing, and thus won't have
any effect when set on a domain with a single group. Add it to
SD_DEGENERATE_GROUPS_MASK.

Signed-off-by: Valentin Schneider <valentin.schneider@xxxxxxx>
---
include/linux/sched/sd_flags.h | 4 +++-
kernel/sched/topology.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched/sd_flags.h b/include/linux/sched/sd_flags.h
index 4f07b405564e..75c9749a6e2d 100644
--- a/include/linux/sched/sd_flags.h
+++ b/include/linux/sched/sd_flags.h
@@ -131,8 +131,10 @@ SD_FLAG(SD_ASYM_PACKING, SDF_SHARED_CHILD)
*
* Set up until domains start spanning NUMA nodes. Close to being a SHARED_CHILD
* flag, but cleared below domains with SD_ASYM_CPUCAPACITY.
+ *
+ * NEEDS_GROUPS: Load balancing flag.
*/
-SD_FLAG(SD_PREFER_SIBLING, 0)
+SD_FLAG(SD_PREFER_SIBLING, SDF_NEEDS_GROUPS)

/*
* sched_groups of this level overlap
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 02fd8db747b2..8064f495641b 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -184,7 +184,7 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)

/* Flags needing groups don't count if only 1 group in parent */
if (parent->groups == parent->groups->next)
- pflags &= ~(SD_DEGENERATE_GROUPS_MASK | SD_PREFER_SIBLING);
+ pflags &= ~SD_DEGENERATE_GROUPS_MASK;

if (~cflags & pflags)
return 0;
--
2.27.0