On Wed, 2 Jul 2025 15:15:01 +0100 Usama Arif <usamaarif642@xxxxxxxxx> wrote: [...] > In terms of the approach of doing this, IMHO, I dont think the way to do this > is controversial. After the great feedback from Lorenzo on the prctl series, the > approach would be for userpsace to make a call that just does for_each_vma of the process, > madvises the VMAs, One dirty hack that I can think off the top of my head for doing this without new kernel changes is, unsurprisingly, using DAMOS. Using DAMOS, users can do madvise(MADV_HUGEPAGE) to virtual address ranges of specific access patterns. It is aimed to be used for hot regions, while using similar one of MADV_NOHUGEPAGE for cold regions. An experiment with a prototype[1] showed it eliminates about 80% of internal fragmentation caused memory overhead while keeping 46% of performance improvement under a constrained situation. If you set the access pattern as any pattern, hence, you can do madvise(MADV_HUGEPAGE) for effectively entire virtual address space of the process. DAMON user-space tool supports periodically tracking childs and applying same DAMOS scheme to those. So, for example, below hack could be tried. # damo start $(pidof XXX) --damos_action hugepage --include_child_tasks I'm working with Usama at Meta but not very closely involved in THP works, so I'm not sure if this works for Usama's case and others. I even not tried this at all on any test environment. So I'm not recommending this but just sharing a thought for more brainsorming, and that's why I call this a dirty hack. [1] https://assets.amazon.science/b7/2b/ce53222247739b174f2b54498d1a/daos-data-access-aware-operating-system.pdf Thanks, SJ [...]