From: Andrew Morton <akpm@linux-foundation.org>
To: kaiyang2@cs.cmu.edu
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
roman.gushchin@linux.dev, shakeel.butt@linux.dev,
muchun.song@linux.dev, mhocko@kernel.org, nehagholkar@meta.com,
abhishekd@meta.com, hannes@cmpxchg.org, weixugc@google.com,
rientjes@google.com
Subject: Re: [PATCH v3] mm,memcg: provide per-cgroup counters for NUMA balancing operations
Date: Wed, 14 Aug 2024 13:52:01 -0700 [thread overview]
Message-ID: <20240814135201.58cd0760bbeab13fcea82c4a@linux-foundation.org> (raw)
In-Reply-To: <20240814174227.30639-1-kaiyang2@cs.cmu.edu>
On Wed, 14 Aug 2024 17:42:27 +0000 kaiyang2@cs.cmu.edu wrote:
> From: Kaiyang Zhao <kaiyang2@cs.cmu.edu>
>
> The ability to observe the demotion and promotion decisions made by the
> kernel on a per-cgroup basis is important for monitoring and tuning
> containerized workloads on either NUMA machines or machines
> equipped with tiered memory.
>
> Different containers in the system may experience drastically different
> memory tiering actions that cannot be distinguished from the global
> counters alone.
>
> For example, a container running a workload that has a much hotter
> memory accesses will likely see more promotions and fewer demotions,
> potentially depriving a colocated container of top tier memory to such
> an extent that its performance degrades unacceptably.
>
> For another example, some containers may exhibit longer periods between
> data reuse, causing much more numa_hint_faults than numa_pages_migrated.
> In this case, tuning hot_threshold_ms may be appropriate, but the signal
> can easily be lost if only global counters are available.
>
> This patch set adds seven counters to memory.stat in a cgroup:
> numa_pages_migrated, numa_pte_updates, numa_hint_faults, pgdemote_kswapd,
> pgdemote_khugepaged, pgdemote_direct and pgpromote_success. pgdemote_*
> and pgpromote_success are also available in memory.numa_stat.
>
> count_memcg_events_mm() is added to count multiple event occurrences at
> once, and get_mem_cgroup_from_folio() is added because we need to get a
> reference to the memcg of a folio before it's migrated to track
> numa_pages_migrated. The accounting of PGDEMOTE_* is moved to
> shrink_inactive_list() before being changed to per-cgroup.
>
> ...
>
> @@ -1383,6 +1412,13 @@ static const struct memory_stat memory_stats[] = {
> { "workingset_restore_anon", WORKINGSET_RESTORE_ANON },
> { "workingset_restore_file", WORKINGSET_RESTORE_FILE },
> { "workingset_nodereclaim", WORKINGSET_NODERECLAIM },
> +
> + { "pgdemote_kswapd", PGDEMOTE_KSWAPD },
> + { "pgdemote_direct", PGDEMOTE_DIRECT },
> + { "pgdemote_khugepaged", PGDEMOTE_KHUGEPAGED },
> +#ifdef CONFIG_NUMA_BALANCING
> + { "pgpromote_success", PGPROMOTE_SUCCESS },
> +#endif
> };
Please document these in Documentation/admin-guide/cgroup-v2.rst
prev parent reply other threads:[~2024-08-14 20:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 17:42 kaiyang2
2024-08-14 20:52 ` Andrew Morton [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=20240814135201.58cd0760bbeab13fcea82c4a@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=abhishekd@meta.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kaiyang2@cs.cmu.edu \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=nehagholkar@meta.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=weixugc@google.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