From: JP Kobryn <jp.kobryn@linux.dev>
To: Frank van der Linden <fvdl@google.com>
Cc: akpm@linux-foundation.org, vbabka@kernel.org, surenb@google.com,
mhocko@suse.com, jackmanb@google.com, hannes@cmpxchg.org,
ziy@nvidia.com, linux-mm@kvack.org, usama.arif@linux.dev,
kirill@shutemov.name, willy@infradead.org,
linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH] mm/page_alloc: skip high atomic reservation at or below costly order
Date: Tue, 16 Jun 2026 13:00:13 -0700 [thread overview]
Message-ID: <73cf2b7c-2423-4b96-b98b-a1946e9f952a@linux.dev> (raw)
In-Reply-To: <CAPTztWYuYA3qBTQrnRVH2W5yxyBZt4OM7Ws3vUxmRGNriOeVEQ@mail.gmail.com>
On 5/28/26 10:09 AM, Frank van der Linden wrote:
> On Mon, May 18, 2026 at 6:25 PM JP Kobryn (Meta) <jp.kobryn@linux.dev> wrote:
>>
>> We're seeing a pattern in production where 2MB THP order-9 allocations are
>> failing due to fragmentation and triggering reclaim on systems with plenty
>> of free memory. Over time, the success rate of these THP allocations do not
>> increase at all.
>>
>> Inspecting zone->vm_stat[NR_FREE_PAGES] via kprobe on compaction_suitable()
>> indicated the given zone had sufficient free pages for order-9 allocations,
>> yet they were going unused. Drilling down into the zone and inspecting
>> /proc/pagetypeinfo revealed why. Order-9 blocks were accumulating in the
>> zone's HighAtomic bucket (while zero were present in Movable). THP is
>> unable to draw blocks from HighAtomic since that bucket is not in the
>> fallback list.
>>
>> The heuristic for reserving pageblocks in HighAtomic is that any atomic
>> allocation greater than order-0 will result in the full pageblock being
>> captured. This means that an order-1 atomic allocation will over-reserve by
>> 256x, a full 512 pageblock.
>>
>> Gate the reservation on order. Skip for allocations at or below
>> PAGE_ALLOC_COSTLY_ORDER. This prevents smaller atomic allocations from
>> reserving entire pageblocks, and significantly helps when THP is in use on
>> a fragmented but otherwise healthy system.
>>
>> Testing was performed using an A/B instagram workload receiving prod
>> traffic. Each side had ~60 hosts with 64G memory. The patch resulted in
>> several gains:
>>
>> Unpatched
>> HighAtomic pageblocks per host: 309-312 (1% of zone or 620MB),
>> ...all order-9 blocks in HighAtomic
>> THP success rate: 1-6%
>> Compaction success rate: 0-2%
>> pgscan_kswapd (total across ~60 hosts, per minute): ~70.2M
>> Atomic order-4+ allocations: 0
>>
>> Patched
>> HighAtomic pageblocks per host: 1
>> THP success rate: 44-78%
>> Compaction success rate: 24-47%
>> pgscan_kswapd (total across ~60 hosts, per minute): ~29.9M
>> Atomic order-4+ allocations: 0
>>
>> Note that for this workload all atomic allocations were order 0-3
>> originating from the network stack, btrfs, and scheduler.
>>
>> Signed-off-by: JP Kobryn (Meta) <jp.kobryn@linux.dev>
>
> Was this issue reproduced with a tree that does not have your patch,
> but includes b480cbb07102 ("mm/page_alloc: don't increase highatomic
> reserve after pcp alloc") ? The symptoms here seem the same.
>
No it was not, but thanks for sharing this. I could see this patch
helping a situation like this. See this patch [0] for an update on the
buddy side.
[0] https://lore.kernel.org/all/20260616191420.52556-1-jp.kobryn@linux.dev/
prev parent reply other threads:[~2026-06-16 20:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 1:25 [PATCH] mm/page_alloc: skip high atomic reservation at or below costly order JP Kobryn (Meta)
2026-05-19 19:27 ` Andrew Morton
2026-05-19 23:25 ` JP Kobryn (Meta)
2026-05-19 20:28 ` Johannes Weiner
2026-05-25 9:11 ` Vlastimil Babka (SUSE)
2026-05-27 5:57 ` JP Kobryn
2026-05-28 13:57 ` Vlastimil Babka (SUSE)
2026-06-16 19:58 ` JP Kobryn
2026-05-27 2:33 ` JP Kobryn
2026-05-28 17:09 ` Frank van der Linden
2026-06-16 20:00 ` JP Kobryn [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=73cf2b7c-2423-4b96-b98b-a1946e9f952a@linux.dev \
--to=jp.kobryn@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=fvdl@google.com \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=kernel-team@meta.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=willy@infradead.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