Re: [PATCH] mm: memcontrol: flush percpu vmevents before releasing memcg

From: Roman Gushchin
Date: Mon Aug 12 2019 - 20:30:19 EST


On Mon, Aug 12, 2019 at 04:37:54PM -0700, Roman Gushchin wrote:
> Similar to vmstats, percpu caching of local vmevents leads to an
> accumulation of errors on non-leaf levels. This happens because
> some leftovers may remain in percpu caches, so that they are
> never propagated up by the cgroup tree and just disappear into
> nonexistence with on releasing of the memory cgroup.
>
> To fix this issue let's accumulate and propagate percpu vmevents
> values before releasing the memory cgroup similar to what we're
> doing with vmstats.
>
> Since on cpu hotplug we do flush percpu vmstats anyway, we can
> iterate only over online cpus.

Just to clarify: this patch should be placed on top of two other
patches, which I sent a bit earlier today:

1) mm: memcontrol: flush percpu slab vmstats on kmem offlining
2) mm: memcontrol: flush percpu vmstats before releasing memcg

Sorry for the inconvenience, I forgot about vmevents during
working on the final version, and remembered too late.

Thanks!