Re: [PATCH v2 1/2] mm: kasan: skip KASAN for GFP_HIGHUSER

From: Jeff Xu

Date: Thu Dec 03 2026 - 14:11:44 EST


On Tue, Dec 01, 2026 at 12:33:56PM -0600, Andrey Ryabinin wrote:
> Jeff Xu <jeffxu@xxxxxxxxxxxx> writes:
>
> > On an Armv9.2-A device (6.12 kernel, kasan.mode=sync), this reduces
> > 32 MB /dev/dma_heap/system alloc+free latency by ~80% (~59% alloc, ~98%
> > close) and improves an app-loading OpenGL benchmark by 15-23%.
> >
>
> The changelog describes this as a performance change, however for at least the
> HugeTLB allocated with GFP_HIGHUSER case this looks like a fix for a
> false positive.
>
> Since the 25c17c4b55de ("hugetlb: arm64: add mte support") can be
> mapped with PROT_MTE.
> Anything that can be mapped with userspace tags shouldn't have
> in-kernel KASAN tags,
> otherwise it would lead to false positive.

Good catch, I agree with you. I'll update the commit message in v3 to
describe this PROT_MTE false positive fix (referencing 25c17c4b55de)
alongside the DMA-BUF/GPU performance numbers.

Should I also add Fixes: 25c17c4b55de ("hugetlb: arm64: add mte support")
for stable backporting?

> > Callers that access GFP_HIGHUSER pages through kmap_local_page() or
> > page_address() (such as ramfs, pipe/FUSE buffers, kexec, and RDS) lose
> > HW_TAGS checking on those pages. None of them store kernel structs
> > there; this matches the trade-off already made for GFP_HIGHUSER_MOVABLE.
>
> I think the main reason GFP_HIGHUSER_MOVABLE skips KASAN tags today is that is
> because userspace might use tags and has nothing to do with not storing kernel
> structs there.

Fair point. I'll reword the commit message in v3 so the PROT_MTE
requirement is stated as the main reason, with the per-granule tagging
overhead as the additional performance benefit.

Thanks,
Jeff