Re: [PATCH] Revert "perf/aux: Allocate non-contiguous AUX pages by default"

From: Leo Yan

Date: Wed Nov 18 2026 - 11:57:55 EST


On Sun, Nov 15, 2026 at 08:32:16PM +0530, Dev Jain wrote:

[...]

> > 1. Make opportunistic high-order AUX allocations no-reclaim:
> > When !(event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) and
> > order > 0, clear __GFP_RECLAIM (and add __GFP_NOMEMALLOC, matching
> > SLUB's allocate_slab() and GFP_TRANSHUGE_LIGHT):
> >
> > gfp_t gfp = PERF_AUX_GFP;
> >
> > if (order && !has_no_sg)
> > gfp = (PERF_AUX_GFP | __GFP_NOMEMALLOC) & ~__GFP_RECLAIM;
>
> Thanks for your reply.
>
> This looks like the correct solution. Note commit 0e05a469c294
> ("mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations")
> post which the regression you report should reduce drastically. It only
> removes GFP_DIRECT_RECLAIM flag, I assume you are seeing latency even
> due to reclaim/compaction daemon wakeups.
>
> So instead of enhancing this commit even more by making a page-allocator
> change, I would rather make your proposed change on the perf side to
> keep it simple. This should completely solve the problem.

Thanks a lot, Dev!

The revert (526d945ad9c0) and 0e05a469c294 are now in mainline. My tests
show significantly lower PSI on v7.4-rc3, consistent with the expected
benefit of 0e05a469c294.

The following PSI some values are totals in milliseconds across runs
2-10 (nine runs), excluding the first run of each case to avoid
glitches caused by its proximity to lauching the pressure workload:

Memory usage v7.4-rc1 v7.4-rc3 rc3 + perf patch [1]
90% 0.000 0.000 0.000
95% 21.781 0.000 2.061
100% 27.946 0.000 0.000

My perf patch [1] reduces pageoutrun and compact_daemon_wake, but
increases pgscan_kswapd at 95%. The following totals compare v7.4-rc3
and v7.4-rc + my patch, also across runs 2-10:

Usage pageoutrun compact_daemon_wake pgscan_kswapd
90% 58 -> 0 57 -> 0 1,932 -> 0
95% 3 -> 2 2 -> 1 9,664 -> 148,079
100% 40 -> 1 40 -> 0 11,616 -> 1,918

I would wait for Yabin's testing before deciding whether to proceed
with the additional perf changes. In my patch, changing order 0 to
__GFP_RETRY_MAYFAIL needs care: it may reduce allocation failures when
free memory is scarce, at the cost of longer reclaim stalls and
higher PSI.

Yabin, could you test the current mainline (or backport
526d945ad9c0/0e05a469c294) and confirm whether it resolves the PSI issue
on Android? If still see the reclaim pressure or observe AUX allocation
failures, it may also be worth testing patch [1].

Thanks,
Leo

[1] https://lore.kernel.org/lkml/20261109-perf_aux_alloc_optimize_psi-v1-1-d56ac4bf3ef5@xxxxxxx/