From: Johannes Weiner <hannes@cmpxchg.org>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>, Nhat Pham <nphamcs@gmail.com>,
akpm@linux-foundation.org, riel@surriel.com,
roman.gushchin@linux.dev, shakeelb@google.com,
muchun.song@linux.dev, tj@kernel.org, lizefan.x@bytedance.com,
shuah@kernel.org, yosryahmed@google.com, linux-mm@kvack.org,
kernel-team@meta.com, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org
Subject: Re: [PATCH 0/2] hugetlb memcg accounting
Date: Mon, 2 Oct 2023 10:42:50 -0400 [thread overview]
Message-ID: <20231002144250.GA4414@cmpxchg.org> (raw)
In-Reply-To: <20231001232730.GA11194@monkey>
On Sun, Oct 01, 2023 at 04:27:30PM -0700, Mike Kravetz wrote:
> On 09/27/23 14:47, Johannes Weiner wrote:
> > On Wed, Sep 27, 2023 at 01:21:20PM +0200, Michal Hocko wrote:
> > > On Tue 26-09-23 12:49:47, Nhat Pham wrote:
> >
> > So that if you use 80% hugetlb, the other memory is forced to stay in
> > the remaining 20%, or it OOMs; and that if you don't use hugetlb, the
> > group is still allowed to use the full 100% of its host memory
> > allowance, without requiring some outside agent continuously
> > monitoring and adjusting the container limits.
>
> Jumping in late here as I was traveling last week. In addition, I want
> to state my limited cgroup knowledge up front.
>
> I was thinking of your scenario above a little differently. Suppose a
> group is up and running at almost 100% memory usage. However, the majority
> of that memory is reclaimable. Now, someone wants to allocate a 2M hugetlb
> page. There is not 2MB free, but we could easily reclaim 2MB to make room
> for the hugetlb page. I may be missing something, but I do not see how that
> is going to happen. It seems like we would really want that behavior.
But that is actually what it does, no?
alloc_hugetlb_folio
mem_cgroup_hugetlb_charge_folio
charge_memcg
try_charge
!page_counter_try_charge ?
!try_to_free_mem_cgroup_pages ?
mem_cgroup_oom
So it does reclaim when the hugetlb hits the cgroup limit. And if that
fails to make room, it OOMs the cgroup.
Or maybe I'm missing something?
next prev parent reply other threads:[~2023-10-02 14:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 19:49 Nhat Pham
2023-09-26 19:49 ` [PATCH 1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller Nhat Pham
2023-09-26 20:50 ` [PATCH 0/2] hugetlb memcg accounting Frank van der Linden
2023-09-26 22:14 ` Johannes Weiner
2023-09-27 12:50 ` Michal Hocko
2023-09-27 16:44 ` Johannes Weiner
2023-09-27 17:22 ` Nhat Pham
2023-09-26 23:31 ` Nhat Pham
2023-09-27 11:21 ` Michal Hocko
2023-09-27 18:47 ` Johannes Weiner
2023-09-27 21:37 ` Roman Gushchin
2023-09-28 12:52 ` Johannes Weiner
2023-10-01 23:27 ` Mike Kravetz
2023-10-02 14:42 ` Johannes Weiner [this message]
2023-10-02 14:58 ` Michal Hocko
2023-10-02 15:36 ` Johannes Weiner
2023-09-27 23:33 ` Nhat Pham
2023-09-28 1:00 ` Nhat Pham
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=20231002144250.GA4414@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizefan.x@bytedance.com \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=nphamcs@gmail.com \
--cc=riel@surriel.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
--cc=yosryahmed@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