Re: [PATCH] mm: memcontrol: separate {pgscan,pgsteal}_{kswapd,direct} items in memory.stat of cgroup v2

From: Johannes Weiner
Date: Fri Jun 03 2022 - 11:38:24 EST


On Fri, Jun 03, 2022 at 03:04:23PM +0800, Qi Zheng wrote:
> There are already statistics of {pgscan,pgsteal}_kswapd and
> {pgscan,pgsteal}_direct of memcg event here, but now the sum
> of the two is displayed in memory.stat of cgroup v2.
>
> In order to obtain more accurate information during monitoring
> and debugging, and to align with the display in /proc/vmstat,
> it better to display {pgscan,pgsteal}_kswapd and
> {pgscan,pgsteal}_direct separately.
>
> Moreover, after this modification, all memcg events can be
> printed with a combination of vm_event_name() and memcg_events().
> This allows us to create an array to traverse and print, which
> reduces redundant seq_buf_printf() codes.
>
> Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>

Sounds good to me. We inititally didn't do it because /proc/vmstat has
the breakdown to understand global reclaim behavior, and cgroup
reclaim doesn't have a kswapd. But it's nice to stay consistent, it's
helpful to understand if certain cgroups have a higher share of direct
global reclaim (GFP_TRANSHUGE* for example), and we very much do want
kswapd per cgroup down the line (we've had it in production for ages).

Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>