linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yu Zhao <yuzhao@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, Kaiyang Zhao <kaiyang2@cs.cmu.edu>,
	linux-kernel@vger.kernel.org,  Li Zhijian <lizhijian@fujitsu.com>
Subject: Re: [PATCH 2/2] mm/vmscan: Fix pgdemote_* accounting with lru_gen_enabled
Date: Wed, 15 Jan 2025 14:51:41 -0700	[thread overview]
Message-ID: <CAOUHufZ3B5FyfqwgB04gys_5yhatzcE_hFh-sedzFUpQFVA+Nw@mail.gmail.com> (raw)
In-Reply-To: <20250110122133.423481-2-lizhijian@fujitsu.com>

On Fri, Jan 10, 2025 at 5:20 AM Li Zhijian <lizhijian@fujitsu.com> wrote:
>
> Commit f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")
> moved the accounting of PGDEMOTE_* statistics to shrink_inactive_list().
> However, shrink_inactive_list() is not called when lrugen_enabled is true,
> leading to incorrect demotion statistics despite actual demotion events
> occurring.
>
> Add the PGDEMOTE_* accounting in evict_folios(), ensuring that demotion
> statistics are correctly updated regardless of the lru_gen_enabled state.
> This fix is crucial for systems that rely on accurate NUMA balancing
> metrics for performance tuning and resource management.
>
> Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
> ---
>  mm/vmscan.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 430d580e37dd..f2d279de06c4 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -4642,6 +4642,8 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap
>                 reset_batch_size(walk);
>         }
>
> +       __mod_lruvec_state(lruvec, PGDEMOTE_KSWAPD + reclaimer_offset(),
> +                          stat.nr_demoted);

The mm-hotfixes-stable already has the same fix from Donet:
https://lore.kernel.org/linux-mm/20250109060540.451261-1-donettom@linux.ibm.com/

Andew, can you please drop this one from mm-unstable so that we won't
increment the counter twice?

Thanks!


  reply	other threads:[~2025-01-15 21:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10 12:21 [PATCH 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics Li Zhijian
2025-01-10 12:21 ` [PATCH 2/2] mm/vmscan: Fix pgdemote_* accounting with lru_gen_enabled Li Zhijian
2025-01-15 21:51   ` Yu Zhao [this message]
2025-01-10 12:49 ` [PATCH 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics Kaiyang Zhao
2025-01-10 14:19   ` Zhijian Li (Fujitsu)
2025-01-10 14:24     ` Zhijian Li (Fujitsu)
2025-01-10 15:24       ` Kaiyang Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOUHufZ3B5FyfqwgB04gys_5yhatzcE_hFh-sedzFUpQFVA+Nw@mail.gmail.com \
    --to=yuzhao@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=kaiyang2@cs.cmu.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizhijian@fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox