From: Yu Zhao <yuzhao@google.com>
To: Andrew Morton <akpm@linux-foundation.org>, Link Lin <linkl@google.com>
Cc: David Rientjes <rientjes@google.com>,
Vlastimil Babka <vbabka@suse.cz>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH mm-unstable v2] mm/page_alloc: keep track of free highatomic
Date: Fri, 25 Oct 2024 22:40:38 -0600 [thread overview]
Message-ID: <CAOUHufbJs3GxZGsJQT6AHQzz2KAETVwWCaGjeybTTCH0K2Nu7Q@mail.gmail.com> (raw)
In-Reply-To: <20241025212448.b1a9069d71df5b497e1b0190@linux-foundation.org>
On Fri, Oct 25, 2024 at 10:24 PM Andrew Morton
<akpm@linux-foundation.org> wrote:
>
> On Fri, 25 Oct 2024 21:36:25 -0600 Yu Zhao <yuzhao@google.com> wrote:
>
> > OOM kills due to vastly overestimated free highatomic reserves were
> > observed:
> >
> > ... invoked oom-killer: gfp_mask=0x100cca(GFP_HIGHUSER_MOVABLE), order=0 ...
> > Node 0 Normal free:1482936kB boost:0kB min:410416kB low:739404kB high:1068392kB reserved_highatomic:1073152KB ...
> > Node 0 Normal: 1292*4kB (ME) 1920*8kB (E) 383*16kB (UE) 220*32kB (ME) 340*64kB (E) 2155*128kB (UE) 3243*256kB (UE) 615*512kB (U) 1*1024kB (M) 0*2048kB 0*4096kB = 1477408kB
>
> Under what circumstances?
Link wrote a repro, so he'd be the best person to answer this question.
Link, please help. Thanks.
> > The second line above shows that the OOM kill was due to the following
> > condition:
> >
> > free (1482936kB) - reserved_highatomic (1073152kB) = 409784KB < min (410416kB)
> >
> > And the third line shows there were no free pages in any
> > MIGRATE_HIGHATOMIC pageblocks, which otherwise would show up as type
> > 'H'. Therefore __zone_watermark_unusable_free() underestimated the
> > usable free memory by over 1GB, which resulted in the unnecessary OOM
> > kill above.
> >
> > The comments in __zone_watermark_unusable_free() warns about the
> > potential risk, i.e.,
> >
> > If the caller does not have rights to reserves below the min
> > watermark then subtract the high-atomic reserves. This will
> > over-estimate the size of the atomic reserve but it avoids a search.
> >
> > However, it is possible to keep track of free pages in reserved
> > highatomic pageblocks with a new per-zone counter nr_free_highatomic
> > protected by the zone lock, to avoid a search when calculating the
> > usable free memory. And the cost would be minimal, i.e., simple
> > arithmetics in the highatomic alloc/free/move paths.
>
> Is a -stable backport needed?
>
> If so, is a Fixes: target identifiable?
The code has been there for many years, and we only recently noticed
the problem from Link's repro. So it doesn't look like a stable
material.
next prev parent reply other threads:[~2024-10-26 4:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 3:36 Yu Zhao
2024-10-26 4:24 ` Andrew Morton
2024-10-26 4:40 ` Yu Zhao [this message]
2024-10-27 19:40 ` Vlastimil Babka
2024-10-27 20:03 ` Yu Zhao
2024-10-26 5:35 ` David Rientjes
2024-10-27 19:53 ` Vlastimil Babka
2024-10-27 20:17 ` Yu Zhao
2024-10-27 20:36 ` Vlastimil Babka
2024-10-27 20:51 ` Yu Zhao
2024-10-27 21:05 ` Vlastimil Babka
2024-10-28 0:24 ` Yu Zhao
2024-10-28 11:04 ` Vlastimil Babka
2024-10-28 17:54 ` Yu Zhao
2024-10-28 18:29 ` Vlastimil Babka
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=CAOUHufbJs3GxZGsJQT6AHQzz2KAETVwWCaGjeybTTCH0K2Nu7Q@mail.gmail.com \
--to=yuzhao@google.com \
--cc=akpm@linux-foundation.org \
--cc=linkl@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
/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