On Thu, Oct 24, 2024 at 06:04:41PM +0200, Vlastimil Babka wrote:
Petr suggested the same, but changing __thp_get_unmapped_area() affects FS THP's and the proposed check seemed wrong to me:
https://lore.kernel.org/all/9d7c73f6-1e1a-458b-93c6-3b44959022e0@suse.cz/
While it could be fixed, I'm still not sure if we want to restrict FS THPs the same as anonymous THPs. AFAIU even small mappings of a range from a file should be aligned properly to make it possible for a large range from the same file (that includes the smaller range) mapped elsewhere to be THP backed? I mean we can investigate it further, but for the regression fix to backported to stable kernels it seemed more safe to address only the case that was changed by commit efa7df3e3bb5 specifically, i.e. anonymous mappings.
Ack, yeah totally agreed - sorry I missed the fs usage before, see my 2nd reply. I had wrongly assumed this was only used in 1 place, where it would be sensible to move the check, however with fs using it of course it's not.
Gave an R-b tag on other reply so this patch LGTM! :)
Cheers for finding this utterly critical fix!