[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALvZod6Np0uqpSCVL-x=pS7uq6FDVUfBstTZE3fYwK4=WvfdFQ@mail.gmail.com>
Date: Sun, 4 Dec 2022 21:03:54 -0800
From: Shakeel Butt <shakeelb@...gle.com>
To: Hugh Dickins <hughd@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Johannes Weiner <hannes@...xchg.org>,
Yu Zhao <yuzhao@...gle.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH] mm: memcg: fix swapcached stat accounting
On Sun, Dec 4, 2022 at 5:01 PM Hugh Dickins <hughd@...gle.com> wrote:
>
> I'd been worried by high "swapcached" counts in memcg OOM reports,
> thought we had a problem freeing swapcache, but it was just the
> accounting that was wrong.
>
> Two issues:
>
> 1. When __remove_mapping() removes swapcache, __delete_from_swap_cache()
> relies on memcg_data for the right counts to be updated; but that had
> already been reset by mem_cgroup_swapout(). Swap those calls around -
> mem_cgroup_swapout() does not require the swapcached flag to be set.
>
> 6.1 commit ac35a4902374 ("mm: multi-gen LRU: minimal implementation")
> already made a similar swap for workingset_eviction(), but not for this.
>
> 2. memcg's "swapcached" count was added for memcg v2 stats, but displayed
> on OOM even for memcg v1: so mem_cgroup_move_account() ought to move it.
>
> Fixes: b6038942480e ("mm: memcg: add swapcache stat for memcg v2")
> Signed-off-by: Hugh Dickins <hughd@...gle.com>
Acked-by: Shakeel Butt <shakeelb@...gle.com>
Powered by blists - more mailing lists