Re: [PATCH] mm/memcontrol: add per-memcg pgpgin/pswpin counter

From: Shakeel Butt
Date: Tue Sep 10 2024 - 03:09:38 EST


On Fri, Aug 30, 2024 at 04:22:44PM GMT, Jingxiang Zeng wrote:
> From: Jingxiang Zeng <linuszeng@xxxxxxxxxxx>
>
> In proactive memory reclamation scenarios, it is necessary to
> estimate the pswpin and pswpout metrics of the cgroup to
> determine whether to continue reclaiming anonymous pages in
> the current batch. This patch will collect these metrics and
> expose them.

Please explain a bit more on how these metrics will be used to make
a decision to continue to do proactive reclaim or not.

>
> Signed-off-by: Jingxiang Zeng <linuszeng@xxxxxxxxxxx>
> ---
> mm/memcontrol-v1.c | 2 ++
> mm/memcontrol.c | 2 ++
> mm/page_io.c | 4 ++++
> 3 files changed, 8 insertions(+)
>
> diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
> index b37c0d870816..44803cbea38a 100644
> --- a/mm/memcontrol-v1.c
> +++ b/mm/memcontrol-v1.c
> @@ -2729,6 +2729,8 @@ static const char *const memcg1_stat_names[] = {
> static const unsigned int memcg1_events[] = {
> PGPGIN,
> PGPGOUT,
> + PSWPIN,
> + PSWPOUT,
> PGFAULT,
> PGMAJFAULT,
> };

As Yosry said, no need to add these in v1.

thanks,
Shakeel