Re: [PATCH] ovl: implement ->get_unmapped_area()
From: Yuan-Hao Hsu
Date: Mon Sep 14 2026 - 07:51:33 EST
On Mon, 31 Aug 2026 at 16:18, Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
> There seems to be a logical fallacy in saying thp_get_unmapepd_area is
> the most suitable value, yet not making it the default for all
> filesystems.
>
> Saying this without any understanding of the subtle difference between
> setting .get_unmapepd_area to NULL and to thp_get_unmapepd_area. All
> I can see that the difference is indeed subtle.
>
> Can you please explain?
I had a look at this. thp_get_unmapped_area() aligns anything with
room for a whole PMD in it; nothing asks whether the file can use it.
NULL means no alignment at all, and 34d7cf637c43 kept files there to
avoid "unnecessary VMA fragmentation and potentially worse performance
on filesystems that do not actually support THPs". The case where
that matters is a lower without large folios. 32 x 3M files,
mmap(NULL, ...):
ovl over ext4 ovl over squashfs
NULL (today) 16/32 aligned, no gaps 16/32 aligned, no gaps
delegate (v1) 32/32, 31744K of gaps 16/32, no gaps
thp_get_unmapped_area 32/32, 31744K of gaps 32/32, 31744K of gaps
squashfs has no large folios, so the alignment buys nothing there
(fault counts were identical) and costs 1M of address space per
mapping. v1 only avoids that by inheriting the lower's choice. fuse
passthrough already pays the same, as Jann noted in the 2024 thread.
Hope this helps.
Thanks,
Yuan-Hao Hsu