Skip to content

Commit 8e0e0ed

Browse files
vingu-linaroPeter Zijlstra
authored andcommitted
sched/numa: Use runnable_avg to classify node
Use runnable_avg to classify numa node state similarly to what is done for normal load balancer. This helps to ensure that numa and normal balancers use the same view of the state of the system. Large arm64system: 2 nodes / 224 CPUs: hackbench -l (256000/#grp) -g #grp grp tip/sched/core +patchset improvement 1 14,008(+/- 4,99 %) 13,800(+/- 3.88 %) 1,48 % 4 4,340(+/- 5.35 %) 4.283(+/- 4.85 %) 1,33 % 16 3,357(+/- 0.55 %) 3.359(+/- 0.54 %) -0,06 % 32 3,050(+/- 0.94 %) 3.039(+/- 1,06 %) 0,38 % 64 2.968(+/- 1,85 %) 3.006(+/- 2.92 %) -1.27 % 128 3,290(+/-12.61 %) 3,108(+/- 5.97 %) 5.51 % 256 3.235(+/- 3.95 %) 3,188(+/- 2.83 %) 1.45 % Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Mel Gorman <mgorman@suse.de> Link: https://lkml.kernel.org/r/20200921072959.16317-1-vincent.guittot@linaro.org
1 parent 848785d commit 8e0e0ed

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

kernel/sched/fair.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,7 @@ enum numa_type {
15041504
/* Cached statistics for all CPUs within a node */
15051505
struct numa_stats {
15061506
unsigned long load;
1507+
unsigned long runnable;
15071508
unsigned long util;
15081509
/* Total compute capacity of CPUs on a node */
15091510
unsigned long compute_capacity;
@@ -1547,6 +1548,7 @@ struct task_numa_env {
15471548
};
15481549

15491550
static unsigned long cpu_load(struct rq *rq);
1551+
static unsigned long cpu_runnable(struct rq *rq);
15501552
static unsigned long cpu_util(int cpu);
15511553
static inline long adjust_numa_imbalance(int imbalance, int src_nr_running);
15521554

@@ -1555,11 +1557,13 @@ numa_type numa_classify(unsigned int imbalance_pct,
15551557
struct numa_stats *ns)
15561558
{
15571559
if ((ns->nr_running > ns->weight) &&
1558-
((ns->compute_capacity * 100) < (ns->util * imbalance_pct)))
1560+
(((ns->compute_capacity * 100) < (ns->util * imbalance_pct)) ||
1561+
((ns->compute_capacity * imbalance_pct) < (ns->runnable * 100))))
15591562
return node_overloaded;
15601563

15611564
if ((ns->nr_running < ns->weight) ||
1562-
((ns->compute_capacity * 100) > (ns->util * imbalance_pct)))
1565+
(((ns->compute_capacity * 100) > (ns->util * imbalance_pct)) &&
1566+
((ns->compute_capacity * imbalance_pct) > (ns->runnable * 100))))
15631567
return node_has_spare;
15641568

15651569
return node_fully_busy;
@@ -1610,6 +1614,7 @@ static void update_numa_stats(struct task_numa_env *env,
16101614
struct rq *rq = cpu_rq(cpu);
16111615

16121616
ns->load += cpu_load(rq);
1617+
ns->runnable += cpu_runnable(rq);
16131618
ns->util += cpu_util(cpu);
16141619
ns->nr_running += rq->cfs.h_nr_running;
16151620
ns->compute_capacity += capacity_of(cpu);

0 commit comments

Comments
 (0)