android_kernel_samsung_msm8976/kernel/sched
Peter Zijlstra 9547ea4dc7 sched/topology: Fix overlapping sched_group_mask
commit 73bb059f9b8a00c5e1bf2f7ca83138c05d05e600 upstream.

The point of sched_group_mask is to select those CPUs from
sched_group_cpus that can actually arrive at this balance domain.

The current code gets it wrong, as can be readily demonstrated with a
topology like:

  node   0   1   2   3
    0:  10  20  30  20
    1:  20  10  20  30
    2:  30  20  10  20
    3:  20  30  20  10

Where (for example) domain 1 on CPU1 ends up with a mask that includes
CPU0:

  [] CPU1 attaching sched-domain:
  []  domain 0: span 0-2 level NUMA
  []   groups: 1 (mask: 1), 2, 0
  []   domain 1: span 0-3 level NUMA
  []    groups: 0-2 (mask: 0-2) (cpu_capacity: 3072), 0,2-3 (cpu_capacity: 3072)

This causes sched_balance_cpu() to compute the wrong CPU and
consequently should_we_balance() will terminate early resulting in
missed load-balance opportunities.

The fixed topology looks like:

  [] CPU1 attaching sched-domain:
  []  domain 0: span 0-2 level NUMA
  []   groups: 1 (mask: 1), 2, 0
  []   domain 1: span 0-3 level NUMA
  []    groups: 0-2 (mask: 1) (cpu_capacity: 3072), 0,2-3 (cpu_capacity: 3072)

(note: this relies on OVERLAP domains to always have children, this is
 true because the regular topology domains are still here -- this is
 before degenerate trimming)

Debugged-by: Lauro Ramos Venancio <lvenanci@redhat.com>
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
Fixes: e3589f6c81 ("sched: Allow for overlapping sched_domain spans")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[bwh: Backported to 3.16:
 - Use span, not sg_span
 - Adjust filename context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2019-07-27 21:45:20 +02:00
..
auto_group.c
auto_group.h
clock.c
core.c sched/topology: Fix overlapping sched_group_mask 2019-07-27 21:45:20 +02:00
cpuacct.c
cpuacct.h
cpudeadline.c sched/deadline: Fix inter- exclusive cpusets migrations 2015-05-19 19:23:16 -07:00
cpudeadline.h sched/deadline: speed up SCHED_DEADLINE pushes with a push-heap 2015-05-19 19:16:03 -07:00
cpupri.c
cpupri.h
cputime.c sched: cpufreq: Adds a field cpu_power in the task_struct 2016-01-05 21:44:05 +05:30
deadline.c sched/dl: Fix preemption checks 2015-05-19 19:23:18 -07:00
debug.c sched: Consolidate cluster-specific information 2015-11-25 21:43:15 -08:00
fair.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
features.h Import latest Samsung release 2017-04-18 03:43:52 +02:00
idle_task.c sched: Consolidate hmp stats into their own struct 2015-01-28 14:13:14 +05:30
Makefile sched/deadline: speed up SCHED_DEADLINE pushes with a push-heap 2015-05-19 19:16:03 -07:00
rt.c sched: Consolidate cluster-specific information 2015-11-25 21:43:15 -08:00
sched.h This is the 3.10.102 stable release 2017-04-18 17:22:08 +02:00
sched_avg.c sched: Fix integer overflow in sched_update_nr_prod() 2016-09-29 02:12:18 -07:00
stats.c
stats.h sched: Use an accessor to read the rq clock 2015-05-19 19:15:56 -07:00
stop_task.c sched/deadline: Add SCHED_DEADLINE structures & implementation 2015-05-19 19:15:57 -07:00
wait.c sched: Move wait.c into kernel/sched/ 2015-05-19 19:15:46 -07:00