[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f179500f-5c58-d559-ff88-0d7bb8f9fa2c@google.com>
Date: Sat, 16 Nov 2024 19:34:04 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Johannes Weiner <hannes@...xchg.org>
cc: Joshua Hahn <joshua.hahnjy@...il.com>, akpm@...ux-foundation.org,
nphamcs@...il.com, shakeel.butt@...ux.dev, roman.gushchin@...ux.dev,
muchun.song@...ux.dev, chris@...isdown.name, tj@...nel.org,
lizefan.x@...edance.com, mkoutny@...e.com, corbet@....net, lnyng@...a.com,
cgroups@...r.kernel.org, linux-mm@...ck.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH v4 1/1] memcg/hugetlb: Add hugeTLB counters to memcg
On Thu, 14 Nov 2024, Johannes Weiner wrote:
> > > > The reason that I opted not to include a breakdown of each hugetlb
> > > > size in memory.stat is only because I wanted to keep the addition that
> > > > this patch makes as minimal as possible, while still addressing
> > > > the goal of bridging the gap between memory.stat and memory.current.
> > > > Users who are curious about this breakdown can see how much memory
> > > > is used by each hugetlb size by enabling the hugetlb controller as well.
> > > >
> > >
> > > While the patch may be minimal, this is solidifying a kernel API that
> > > users will start to count on. Users who may be interested in their
> > > hugetlb usage may not have control over the configuration of their kernel?
> > >
> > > Does it make sense to provide a breakdown in memory.stat so that users can
> > > differentiate between mapping one 1GB hugetlb page and 512 2MB hugetlb
> > > pages, which are different global resources?
> > >
> > > > It's true that this is the case as well for total hugeltb usage, but
> > > > I felt that not including hugetlb memory usage in memory.stat when it
> > > > is accounted by memory.current would cause confusion for the users
> > > > not being able to see that memory.current = sum of memory.stat. On the
> > > > other hand, seeing the breakdown of how much each hugetlb size felt more
> > > > like an optimization, and not a solution that bridges a confusion.
> > > >
> > >
> > > If broken down into hugetlb_2048kB and hugetlb_1048576kB on x86, for
> > > example, users could still do sum of memory.stat, no?>
> > >
> >
> > Friendly ping on this, would there be any objections to splitting the
> > memory.stat metrics out to be per hugepage size?
>
> I don't think it has to be either/or. We can add the total here, and a
> per-size breakdown in a separate patch (with its own changelog)?
>
> That said, a per-size breakdown might make more sense in the hugetlb
> cgroup controller. You're mentioning separate global resources, which
> suggests this is about more explicitly controlled hugetlb use.
>
> From a memcg POV, all hugetlb is the same. It's just (non-swappable)
> memory consumed by the cgroup.
>
Ok, that's fair. We have a local patch that tracks hugetlb usage,
admittedly for all hugetlb sizes, in struct mem_cgroup_per_node so that we
can provide a breakdown in memory.numa_stat because we can't get the
per-node breakdown from hugetlb_cgroup. If there is interest in that
breakdown, we could easily propose the patch.
Powered by blists - more mailing lists