On Tue, Aug 11, 2026 at 10:02:44AM +0100, James Clark wrote:
[...]
The question is how "allocating contiguous AUX pages unnecessarily exacerbates memory fragmentation." The relevant information I could find is [1]:
"On Android, we collect ETM data periodically on internal user devices for AutoFDO optimization (for both userspace libraries and the kernel). Allocating a large chunk of contiguous AUX pages (4M for each CPU) periodically is almost unbearable. The kernel may need to kill many processes to fulfill the request. It affects user experience even after using PMU."
This sounds like it could be an attribute to perf_event_open. We can do PREFER_LARGE by default for performance and fewer discontinuities, but on Android or small systems users can enable an option to revert back to single pages.
Or can this bit be determined at allocation time: "The kernel may need to kill many processes to fulfill the request"? If this memory pressure exists on allocation then do it one way, if not do it the other way.
Be careful with "The kernel may need to kill many processes ...".
The AUX allocator uses:
#define PERF_AUX_GFP (GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN | __GFP_NORETRY)
Documentation/core-api/memory-allocation.rst says that __GFP_NORETRY causes the allocator to "fail early rather than cause disruptive reclaim" and that "the OOM killer is not invoked".
Therefore, it is unlikely to me that AUX allocation itself would cause the kernel OOM killer to kill processes in order to satisfy the request.
I am a bit suspect the original observation was related to Android's lmkd [1], where allocating the AUX buffers increased overall memory pressure and indirectly caused processes to be killed. If so, I think it is important to understand what actually triggered those kills.
Thanks, Leo
[1] https://source.android.com/docs/core/perf/lmkd?hl=en&utm_source=chatgpt....