Re: [PATCH mm-unstable RFC 3/5] memcg: calculate root usage from global state

From: Yosry Ahmed
Date: Tue Apr 11 2023 - 13:00:51 EST


On Tue, Apr 11, 2023 at 5:53 AM Michal Koutný <mkoutny@xxxxxxxx> wrote:
>
> On Mon, Apr 03, 2023 at 10:03:35PM +0000, Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
> > Instead, approximate the root usage from global state. This is not 100%
> > accurate, but the root usage has always been ill-defined anyway.
>
> Technically, this approximation should be closer to truth because global
> counters aren't subject to flushing "delay".

It is a tiny bit different when some pages are in swap, probably
because of swap slot caching and other swap specifics. At least in
cgroup v1, the swap uncharging and freeing of the underlying swap
entry may happen at different times. I think it practically doesn't
really matter though.

>
> >
> > Signed-off-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
> > ---
> > mm/memcontrol.c | 24 +++++-------------------
> > 1 file changed, 5 insertions(+), 19 deletions(-)
>
> But feel free to add
> Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>

Thanks!
>