Re: [PATCH v2 1/2] mm: huge_memory: disallow hugepages if the system-wide THP sysfs settings are disabled

From: Baolin Wang
Date: Mon Jun 09 2025 - 01:57:51 EST




On 2025/6/7 02:47, Dev Jain wrote:

On 06/06/25 10:19 pm, Dev Jain wrote:

On 05/06/25 1:30 pm, Baolin Wang wrote:
The MADV_COLLAPSE will ignore the system-wide Anon THP sysfs settings, which
means that even though we have disabled the Anon THP configuration, MADV_COLLAPSE
will still attempt to collapse into a Anon THP. This violates the rule we have
agreed upon: never means never.

Another rule for madvise, referring to David's suggestion: “allowing for collapsing
in a VM without VM_HUGEPAGE in the "madvise" mode would be fine".

To address this issue, should check whether the Anon THP configuration is disabled
in thp_vma_allowable_orders(), even when the TVA_ENFORCE_SYSFS flag is set.

Did you mean to say "even when the TVA_ENFORCE_SYSFS flag is *not* set"? Because if
is set, then we have to check the anon THP sysfs config.

Sorry for the confusion. What I mean is that we should also check whether the Anon THP is disabled when the TVA_ENFORCE_SYSFS flag is set. Will update the commit message.

Otherwise the patch itself looks good to me, so:

Reviewed-by: Dev Jain <dev.jain@xxxxxxx>

Thanks for reviewing.