On 06/03/25 12:08 pm, Andrew Morton wrote:
On Thu, 6 Mar 2025 12:00:37 +0530 Dev Jain <dev.jain@xxxxxxx> wrote:
We already are registering private-anon VMAs with khugepaged during fault
time, in do_huge_pmd_anonymous_page(). Commit "register suitable readonly
file vmas for khugepaged" moved the khugepaged registration logic from
shmem_mmap to the generic mmap path. Make this logic specific for non-anon
mappings.
Please fully describe the userspace-visible effects of this bug.
Apologies.
The userspace-visible effect should be this: khugepaged will
unnecessarily scan mm's which haven't yet faulted in. Note that it won't
actually collapse because all PTEs are none.
Now that I think about it, the mm is going to have a file VMA anyways
during fork+exec, so the mm already gets registered during mmap due to
the non-anon case (I *think*), so at least one of either the mmap
registration or fault-time registration is redundant.
Fixes: 613bec092fe7 ("mm: mmap: register suitable readonly file vmas for khugepaged")
Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
Thanks, I'll add cc:stable.