From: sashiko-bot@kernel.org
To: "Joanne Koong" <joannelkoong@gmail.com>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH v1 2/3] mm: memcg: read root lruvec LRU stats from the node counters
Date: Mon, 02 Nov 2026 22:58:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-194309@kernel.org> (raw)
In-Reply-To: <20261102225030.2743129-3-joannelkoong@gmail.com>
> Reclaim and refault detection read LRU sizes and workingset counters
> from the target lruvec after a ratelimited rstat flush. For global
> reclaim and the root memcg, that flush covers every cgroup in the
> system, and the ratelimiting can leave the stats stale for seconds.
>
> For stats that only track memory charged to a memcg (LRU sizes,
> workingset, rotation and reclaim writeback counts), the root memcg's
> hierarchical value equals the node counter, which is always up to date.
> Add lruvec_lru_page_state() and a monotonic variant that read the node
> counters for the root memcg, and use them in reclaim and
> workingset_test_recent(). Root reclaim and refault detection then see
> current values instead of stats that can lag by seconds.
>
> workingset_test_recent() only reads the eviction memcg's own lruvec, so
> skip its rstat flush when that is the root memcg. For reclaim however,
> we still need to keep the flush (for now) since global and root reclaim
> also read the rstat stats of the child memcgs they scan, which the flush
> is needed for in order to keep up to date.
>
> On an 80-CPU machine, a root flush took 69us on average with little
> cgroup activity and ~0.9ms with 128 memcgs actively allocating (wall
> time, including waiting for the rstat lock). Reading a node counter
> doesn't add any cost. It took the same amount of time as reading the
> rstat counter (~150ns, which includes bpftrace probe overhead).
>
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261102225030.2743129-1-joannelkoong@gmail.com?part=2
next prev parent reply other threads:[~2026-11-02 22:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 22:50 [PATCH v1 0/3] mm: read root memcg stats from global counters instead of flushing Joanne Koong
2026-11-02 22:50 ` [PATCH v1 1/3] mm: zswap: fix shrinker count for the root memcg Joanne Koong
2026-11-02 23:01 ` sashiko-bot
2026-11-02 23:25 ` Yosry Ahmed
2026-11-03 1:13 ` SJ Park
2026-11-02 22:50 ` [PATCH v1 2/3] mm: memcg: read root lruvec LRU stats from the node counters Joanne Koong
2026-11-02 22:58 ` sashiko-bot [this message]
2026-11-02 23:29 ` Yosry Ahmed
2026-11-03 0:34 ` Joanne Koong
2026-11-03 1:00 ` Yosry Ahmed
2026-11-03 19:28 ` Joanne Koong
2026-11-03 19:33 ` Yosry Ahmed
2026-11-03 22:36 ` Joanne Koong
2026-11-02 22:50 ` [PATCH v1 3/3] mm/damon/core: use node counters instead of flushing the root memcg Joanne Koong
2026-11-02 22:54 ` sashiko-bot
2026-11-03 1:29 ` SJ Park
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=sashiko-outbox-194309@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=joannelkoong@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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