Re: [PATCH v8 14/14] mm: thp: always enable mTHP support
From: Lance Yang
Date: Fri Oct 02 2026 - 23:13:21 EST
On Thu, Sep 17, 2026 at 09:45:35PM -0400, Luiz Capitulino wrote:
>If PMD-sized pages are not supported on an architecture (ie. the
>arch implements arch_has_pmd_leaves() and it returns false) then the
>current code disables all THP, including mTHP.
>
>This commit fixes this by allowing mTHP to be always enabled for all
>archs. When PMD-sized pages are not supported, its sysfs entry won't be
>created and their mapping will be disallowed at page-fault time.
>
>Similarly, this commit implements the following changes for shmem in
>shmem_allowable_huge_orders():
>
> - Drop the pgtable_has_pmd_leaves() check so that mTHP sizes are
> considered
> - Filter out PMD and PUD orders from allowable orders when
> PMD-sized pages are not supported by the CPU
Nit: "and PUD" can go.
David mentioned
"
There is no need to disable PUD-orders, as shmem does not support PUD-orders
(unlike DAX). So you can keep it simpler here.
"
in v4
https://lore.kernel.org/all/ff7bcd65-d444-4da1-890e-75504303ec3f@xxxxxxxxxx/
Cheers, Lance