Skip to content

Commit

Permalink
sched/topology: Simplify build_overlap_sched_groups()
Browse files Browse the repository at this point in the history
Now that the first group will always be the previous domain of this
@cpu this can be simplified.

In fact, writing the code now removed should've been a big clue I was
doing it wrong :/

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 15, 2017
1 parent 0372dd2 commit 91eaed0
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions kernel/sched/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ static void init_overlap_sched_group(struct sched_domain *sd,
static int
build_overlap_sched_groups(struct sched_domain *sd, int cpu)
{
struct sched_group *first = NULL, *last = NULL, *groups = NULL, *sg;
struct sched_group *first = NULL, *last = NULL, *sg;
const struct cpumask *span = sched_domain_span(sd);
struct cpumask *covered = sched_domains_tmpmask;
struct sd_data *sdd = sd->private;
Expand Down Expand Up @@ -587,23 +587,14 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu)

init_overlap_sched_group(sd, sg, i);

/*
* Make sure the first group of this domain contains the
* canonical balance CPU. Otherwise the sched_domain iteration
* breaks. See update_sg_lb_stats().
*/
if ((!groups && cpumask_test_cpu(cpu, sg_span)) ||
group_balance_cpu(sg) == cpu)
groups = sg;

if (!first)
first = sg;
if (last)
last->next = sg;
last = sg;
last->next = first;
}
sd->groups = groups;
sd->groups = first;

return 0;

Expand Down

0 comments on commit 91eaed0

Please sign in to comment.