Re: [RFC PATCH v5 13/16] slub: Enable balancing slabs across nodes

From: Tobin C. Harding
Date: Mon May 20 2019 - 21:48:14 EST

On Tue, May 21, 2019 at 01:04:10AM +0000, Roman Gushchin wrote:
> On Mon, May 20, 2019 at 03:40:14PM +1000, Tobin C. Harding wrote:
> > We have just implemented Slab Movable Objects (SMO). On NUMA systems
> > slabs can become unbalanced i.e. many slabs on one node while other
> > nodes have few slabs. Using SMO we can balance the slabs across all
> > the nodes.
> >
> > The algorithm used is as follows:
> >
> > 1. Move all objects to node 0 (this has the effect of defragmenting the
> > cache).
> This already sounds dangerous (or costly). Can't it be done without
> cross-node data moves?
> >
> > 2. Calculate the desired number of slabs for each node (this is done
> > using the approximation nr_slabs / nr_nodes).
> So that on this step only (actual data size - desired data size) has
> to be moved?

This is just the most braindead algorithm I could come up with. Surely
there are a bunch of things that could be improved. Since I don't know
the exact use case it seemed best not to optimize for any one use case.

I'll review, comment on, and test any algorithm you come up with!