Re: [PATCH -next] mm: don't try THP align for FS without get_unmapped_area

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 6 Dec 2024 15:03:45 +0800 Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> wrote:

> Commit ed48e87c7df3 ("thp: add thp_get_unmapped_area_vmflags()")
> changes thp_get_unmapped_area() to thp_get_unmapped_area_vmflags()
> in __get_unmapped_area(), which won't setup get_area for anonymous
> mappings, but it leads to always try THP align when file ops without
> '.get_unmapped_area' callback too as the get_area is NULL.
> 
> Since commit efa7df3e3bb5 ("mm: align larger anonymous mappings on
> THP boundaries") only want to enable THP align for anonymous, adding
> !file check to fix it.

The above is tough.  I attempted a rewrite, please review for accuracy
and completeness:

: Commit ed48e87c7df3 ("thp: add thp_get_unmapped_area_vmflags()") changes
: thp_get_unmapped_area() to thp_get_unmapped_area_vmflags() in
: __get_unmapped_area(), which doesn't initialize local get_area for
: anonymous mappings.  This leads to us always trying THP alignment even for
: file_operations which have a NULL ->get_unmapped_area() callback.
: 
: Since commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP
: boundaries") we only want to enable THP alignment for anonymous mappings,
: so add a !file check to avoid attempting THP alignment for file mappings.

Also, the changelog failed to describe the userspace-visible effects of
the flaw, which is basically essential when fixing bugs.

The bug has been there since 6.10 so it would be interesting to learn
why it took this long to be noticed.






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux