On Mon, Apr 04, 2022 at 05:48:49PM -0700, Yang Shi wrote: > When khugepaged collapses file THPs, its behavior is not consistent. > It is kind of "random luck" for khugepaged to see the file vmas (see > report: https://lore.kernel.org/linux-mm/00f195d4-d039-3cf2-d3a1-a2c88de397a0@xxxxxxx/) > since currently the vmas are registered to khugepaged when: > - Anon huge pmd page fault > - VMA merge > - MADV_HUGEPAGE > - Shmem mmap > > If the above conditions are not met, even though khugepaged is enabled > it won't see any file vma at all. MADV_HUGEPAGE could be specified > explicitly to tell khugepaged to collapse this area, but when > khugepaged mode is "always" it should scan suitable vmas as long as > VM_NOHUGEPAGE is not set. I don't see that as being true at all. The point of this hack was that applications which really knew what they were doing could enable it. It makes no sense to me that setting "always" by the sysadmin for shmem also force-enables ROTHP, even for applications which aren't aware of it. Most telling, I think, is that Song Liu hasn't weighed in on this at all. It's clearly not important to the original author.