[PATCH 2/2] perf: arm_spe: Prefer large AUX mappings

Leo Yan leo.yan at arm.com
Tue Sep 1 10:06:37 PDT 2026


Hi Will, Yabin,

On Tue, Aug 11, 2026 at 11:17:42AM +0100, Leo Yan 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.

I'd like to follow up on this, as I am not sure how we should proceed
without more information about the original process-kill issue.

If the original process-kill killer issue can be handled on the Android
side (e.g., configure lmkd), we could consider preferring large AUX
mappings by default. Otherwise, we may need to add an perf_event_open()
attribute as James suggested, but that would add complexity to both the
kernel and tools.

Could you share what actually triggered the process kills? That would
help us decide which direction to take.

Thanks,
Leo



More information about the linux-arm-kernel mailing list