Linux Documentation
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@redhat.com>
To: Eric Chanudet <echanude@redhat.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"David Hildenbrand" <david@kernel.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>, "Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Michal Hocko" <mhocko@kernel.org>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	"Shakeel Butt" <shakeel.butt@linux.dev>,
	"Muchun Song" <muchun.song@linux.dev>,
	"Shuah Khan" <shuah@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	"Albert Esteve" <aesteve@redhat.com>
Subject: Re: [PATCH 03/11] cgroup: add memory_cma_accounting mount option
Date: Mon, 24 Aug 2026 09:02:30 +0200	[thread overview]
Message-ID: <20260824-poised-meaty-shellfish-9a09d2@houat> (raw)
In-Reply-To: <20260821-cma-memcg-regions-v1-3-d21b165b8440@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1925 bytes --]

On Fri, Aug 21, 2026 at 02:56:55PM -0400, Eric Chanudet wrote:
> Add a cgroup v2 mount option that will be used later in this series to
> enable CMA memory accounting under memcg.
> 
> The option is made opt-in as it will charge allocations to the cgroup's
> overall memory usage, which changes existing expectations.
> 
> Signed-off-by: Eric Chanudet <echanude@redhat.com>
> ---
>  Documentation/admin-guide/cgroup-v2.rst | 20 ++++++++++++++++++++
>  include/linux/cgroup-defs.h             |  5 +++++
>  kernel/cgroup/cgroup.c                  | 15 ++++++++++++++-
>  3 files changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
> index aed195a71cbf..3dfc13f31a0c 100644
> --- a/Documentation/admin-guide/cgroup-v2.rst
> +++ b/Documentation/admin-guide/cgroup-v2.rst
> @@ -246,6 +246,26 @@ cgroup v2 currently supports the following mount options.
>            will not be tracked by the memory controller (even if cgroup
>            v2 is remounted later on).
>  
> +  memory_cma_accounting
> +        Count CMA memory usage towards the cgroup's overall memory usage for
> +        the memory controller, and expose per-CMA-area usage counters. This
> +        behavior is opt-in, so as to not cause regression on existing setups.
> +
> +        A few caveats to keep in mind:
> +
> +        * CMA areas are reserved at boot time, memory is only charged to a
> +          cgroup when a CMA allocation is performed on its behalf.
> +        * CMA pages allocated while this option is not enabled will not be
> +          tracked by the memory controller, even if cgroup v2 is remounted
> +          later on with this option. Charges happen at allocation.

And what would happen if it's the other way around, ie mounted with this
option enabled, then remounted with the option disabled?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

  reply	other threads:[~2026-08-24  7:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 18:56 [PATCH 00/11] mm/cma: charge cma allocation to memcg using per area counters Eric Chanudet
2026-08-21 18:56 ` [PATCH 01/11] mm/cma: drop const for struct page on release API Eric Chanudet
2026-08-21 18:56 ` [PATCH 02/11] mm/cma: include linux/cma.h in cma.h Eric Chanudet
2026-08-21 18:56 ` [PATCH 03/11] cgroup: add memory_cma_accounting mount option Eric Chanudet
2026-08-24  7:02   ` Maxime Ripard [this message]
2026-08-24 22:03     ` Eric Chanudet
2026-08-21 18:56 ` [PATCH 04/11] memcg: add cma charge/uncharge functions for area counters Eric Chanudet
2026-08-21 18:56 ` [PATCH 05/11] mm/cma: charge cma allocation to memcg per " Eric Chanudet
2026-08-21 18:56 ` [PATCH 06/11] memcg: register per-area usage counters in cgroupfs Eric Chanudet
2026-08-21 18:56 ` [PATCH 07/11] selftests: cgroup: add cma configs for cgroup selftest suite Eric Chanudet
2026-08-21 18:57 ` [PATCH 08/11] selftests: cgroup: add memcg cma tests Eric Chanudet
2026-08-21 18:57 ` [PATCH 09/11] selftests: cgroup: add a vmtest script for memcg Eric Chanudet
2026-08-21 18:57 ` [PATCH 10/11] selftests: cgroup: add memcg hugetlb_cma tests Eric Chanudet
2026-08-21 18:57 ` [PATCH 11/11] selftests: cgroup: amend vmtest-memcg to run the hugetlb cma tests Eric Chanudet
2026-08-23  7:02 ` [PATCH 00/11] mm/cma: charge cma allocation to memcg using per area counters Mike Rapoport
2026-08-24 21:58   ` Eric Chanudet
2026-08-25  7:40     ` Michal Hocko
2026-08-24  8:58 ` Michal Hocko
2026-08-25 14:47   ` Eric Chanudet
2026-08-25 14:59     ` Michal Hocko
2026-08-25 15:45     ` David Hildenbrand (Arm)
2026-08-25 16:26       ` Michal Hocko
2026-08-24 13:18 ` Michal Koutný
2026-08-25 14:54   ` Eric Chanudet

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=20260824-poised-meaty-shellfish-9a09d2@houat \
    --to=mripard@redhat.com \
    --cc=aesteve@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=echanude@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=liam@infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=mkoutny@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=surenb@google.com \
    --cc=tj@kernel.org \
    --cc=vbabka@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