From: Lance Yang <ioworker0@gmail.com>
To: "Michal Koutný" <mkoutny@suse.com>
Cc: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>,
akpm@linux-foundation.org, 21cnbao@gmail.com,
ryan.roberts@arm.com, david@redhat.com, shy828301@gmail.com,
ziy@nvidia.com, libang.li@antgroup.com,
baolin.wang@linux.alibaba.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
Cgroups <cgroups@vger.kernel.org>
Subject: Re: [BUG] mm/cgroupv2: memory.min may lead to an OOM error
Date: Fri, 2 Aug 2024 09:56:04 +0800 [thread overview]
Message-ID: <CAK1f24mOdm6YK=3ZY4QE2eQq4ggeiNKoq_Nhp1bguE8E5jBwBg@mail.gmail.com> (raw)
In-Reply-To: <iedonwzoqj75yeaykgovdufi53cu3ddsrqfhdfui5kgwlal6pq@mdeue6pc6byz>
Hi Michal,
Thanks a lot for clarifying!
On Fri, Aug 2, 2024 at 6:58 AM Michal Koutný <mkoutny@suse.com> wrote:
>
> Hello.
>
> On Thu, Aug 01, 2024 at 07:40:10PM GMT, Lance Yang <ioworker0@gmail.com> wrote:
> > However, if the child cgroup doesn't exist and we add a process to the 'test'
> > cgroup, then attempt to create a large file(2GB) using dd, we won't encounter
> > an OOM error; everything works as expected.
>
> That's due to the way how effective protections are calculated, see [1].
> If reclaim target is cgroup T, then it won't enjoy protection configured
> on itself, whereas the child of T is subject of ancestral reclaim hence
> the protection applies.
Makes sense to me.
>
> That would mean that in your 1st demo, it is test/memory.max that
> triggers reclaim and then failure to reclaim from test/test-child causes
> OOM in test.
> That's interesting since the (same) limit of test-child/memory.max
> should be evaluated first. I guess it is in your example there are
> actually two parallel processes (1321 and 1324) so some charges may
> randomly propagate to the upper test/memory.max limit.
>
> As explained above, the 2nd demo has same reclaim target but due to no
> nesting, protection is moot.
Ah, that clears it up. I appreciate the detailed explanation - thanks!
> I believe you could reproduce with merely
>
> test/memory.max
> test-child/memory.min
Yep, I just tested it, and you're right ;)
>
> > Hmm... I'm a bit confused about that.
>
> I agree, the calculation of effective protection wrt reclaim target can
> be confusing.
>
> The effects you see are documented for memory.min:
>
> > Putting more memory than generally available under this
> > protection is discouraged and may lead to constant OOMs.
Thanks a lot again for your time!
Lance
>
> HTH,
> Michal
>
> [1] https://lore.kernel.org/all/20200729140537.13345-2-mkoutny@suse.com/
prev parent reply other threads:[~2024-08-02 1:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 4:54 Lance Yang
2024-08-01 10:35 ` Vlastimil Babka (SUSE)
2024-08-01 11:40 ` Lance Yang
2024-08-01 22:58 ` Michal Koutný
2024-08-02 1:56 ` Lance Yang [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='CAK1f24mOdm6YK=3ZY4QE2eQq4ggeiNKoq_Nhp1bguE8E5jBwBg@mail.gmail.com' \
--to=ioworker0@gmail.com \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=cgroups@vger.kernel.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=libang.li@antgroup.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mkoutny@suse.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=ryan.roberts@arm.com \
--cc=shakeel.butt@linux.dev \
--cc=shy828301@gmail.com \
--cc=vbabka@kernel.org \
--cc=ziy@nvidia.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