Re: [PATCH v2 1/2] mm, slab: Extend slab/shrink to shrink all memcg caches
From: Roman Gushchin
Date: Thu Jul 18 2019 - 13:05:23 EST
On Thu, Jul 18, 2019 at 11:38:11AM +0000, Christopher Lameter wrote:
> On Wed, 17 Jul 2019, Waiman Long wrote:
>
> > Currently, a value of '1" is written to /sys/kernel/slab/<slab>/shrink
> > file to shrink the slab by flushing out all the per-cpu slabs and free
> > slabs in partial lists. This can be useful to squeeze out a bit more memory
> > under extreme condition as well as making the active object counts in
> > /proc/slabinfo more accurate.
>
> Acked-by: Christoph Lameter <cl@xxxxxxxxx>
>
> > # grep task_struct /proc/slabinfo
> > task_struct 53137 53192 4288 61 4 : tunables 0 0
> > 0 : slabdata 872 872 0
> > # grep "^S[lRU]" /proc/meminfo
> > Slab: 3936832 kB
> > SReclaimable: 399104 kB
> > SUnreclaim: 3537728 kB
> >
> > After shrinking slabs:
> >
> > # grep "^S[lRU]" /proc/meminfo
> > Slab: 1356288 kB
> > SReclaimable: 263296 kB
> > SUnreclaim: 1092992 kB
>
> Well another indicator that it may not be a good decision to replicate the
> whole set of slabs for each memcg. Migrate the memcg ownership into the
> objects may allow the use of the same slab cache. In particular together
> with the slab migration patches this may be a viable way to reduce memory
> consumption.
>
Btw I'm working on an alternative solution. It's way too early to present
anything, but preliminary results are looking promising: slab memory usage
is decreased by 10-40% depending on the workload.
Thanks!