Linux cgroups development
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: SJ Park <sj@kernel.org>,
	akpm@linux-foundation.org, yosry@kernel.org,
	shakeel.butt@linux.dev, hannes@cmpxchg.org, mhocko@kernel.org,
	roman.gushchin@linux.dev, muchun.song@linux.dev,
	nphamcs@gmail.com, chengming.zhou@linux.dev, david@kernel.org,
	ljs@kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org,
	damon@lists.linux.dev
Subject: Re: [PATCH v1 3/3] mm/damon/core: use node counters instead of flushing the root memcg
Date: Mon,  2 Nov 2026 17:29:51 -0800	[thread overview]
Message-ID: <20261103012952.93674-1-sj@kernel.org> (raw)
In-Reply-To: <20261102225030.2743129-4-joannelkoong@gmail.com>

Hi Joanne,


On Mon,  2 Nov 2026 14:50:30 -0800 Joanne Koong <joannelkoong@gmail.com> wrote:

> damos_get_node_memcg_used_bp() flushes the memcg stats before reading
> the LRU sizes of the goal's memcg on the goal's node. For the root
> memcg, that flushes every cgroup in the system. The flush is not
> ratelimited, which means it happens every time the goal is evaluated.

Just thinking loudly.  damos_get_node_memcg_used_bp() is called only once per
DAMOS quota reset interval.  It is usually recommended to set the interval to 1
second.  So a sort of rate limiting is applied in common use cases.  That said,
some users might using quite short interval.  And it is obviously better to
avoid unnecessary flushes.

> 
> For the root memcg, the node counters hold the same LRU sizes as the
> memcg rstat stats, and they are always up to date. Use
> lruvec_lru_page_state(), which reads the node counters for the root
> memcg, and skip the flush for the root memcg.

Again, loud thought.  For root memcg, users might use
DAMOS_QUOTA_NODE_MEM_{USED,FREE}_BP instead, which calls
damos_get_node_mem_bp().  That said, some users might use
DAMOS_QUOTA_NODE_MEMCG_{USED,FREE}_BP for root memcg (maybe it makes user space
tool writing easier?).

So, looks all good to me, thank you for this patch.

> 
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>

Assuming the discussion on patch 2 concludes to have lruvec_lru_page_state(),

Reviewed-by: SJ Park <sj@kernel.org>


Thanks,
SJ

[...]

      reply	other threads:[~2026-11-03  1:29 UTC|newest]

Thread overview: 10+ 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: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 23:29   ` Yosry Ahmed
2026-11-03  0:34     ` Joanne Koong
2026-11-03  1:00       ` Yosry Ahmed
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-03  1:29   ` SJ Park [this message]

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=20261103012952.93674-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=chengming.zhou@linux.dev \
    --cc=damon@lists.linux.dev \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=joannelkoong@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=yosry@kernel.org \
    /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