Re: [RFC PATCH 5/5] numa: numa balancer

From: Peter Zijlstra
Date: Tue Apr 23 2019 - 05:05:51 EST


On Mon, Apr 22, 2019 at 10:21:17AM +0800, çè wrote:
> numa balancer is a module which will try to automatically adjust numa
> balancing stuff to gain numa bonus as much as possible.
>
> For each memory cgroup, we process the work in two steps:
>
> On stage 1 we check cgroup's exectime and memory topology to see
> if there could be a candidate for settled down, if we got one then
> move onto stage 2.
>
> On stage 2 we try to settle down as much as possible by prefer the
> candidate node, if the node no longer suitable or locality keep
> downturn, we reset things and new round begin.
>
> Decision made with find_candidate_nid(), should_prefer() and keep_prefer(),
> which try to pick a candidate node, see if allowed to prefer it and if
> keep doing the prefer.
>
> Tested on the box with 96 cpus with sysbench-mysql-oltp_read_write
> testing, 4 mysqld instances created and attached to 4 cgroups, 4
> sysbench instances then created and attached to corresponding cgroup
> to test the mysql with oltp_read_write script, average eps show:
>
> origin balancer
> 4 instances each 12 threads 5241.08 5375.59 +2.50%
> 4 instances each 24 threads 7497.29 7820.73 +4.13%
> 4 instances each 36 threads 8985.44 9317.04 +3.55%
> 4 instances each 48 threads 9716.50 9982.60 +2.66%
>
> Other benchmark liks dbench, pgbench, perf bench numa also tested, and
> with different parameters and number of instances/threads, most of
> the cases show bonus, some show acceptable regression, and some got no
> changes.
>
> TODO:
> * improve the logical to address the regression cases
> * Find a way, maybe, to handle the page cache left on remote
> * find more scenery which could gain benefit
>
> Signed-off-by: Michael Wang <yun.wang@xxxxxxxxxxxxxxxxx>
> ---
> drivers/Makefile | 1 +
> drivers/numa/Makefile | 1 +
> drivers/numa/numa_balancer.c | 715 +++++++++++++++++++++++++++++++++++++++++++

So I really think this is the wrong direction. Why introduce yet another
balancer thingy and not extend the existing numa balancer with the
additional information you got from the previous patches?

Also, this really should not be a module and not in drivers/