Re: [PATCH 7.2 v2 03/12] mm/huge_memory: remove READ_ONLY_THP_FOR_FS from file_thp_enabled()

From: Zi Yan

Date: Tue Apr 14 2026 - 12:02:30 EST


On 14 Apr 2026, at 6:40, David Hildenbrand (Arm) wrote:

> On 4/13/26 21:20, Zi Yan wrote:
>> Replace it with a check on the max folio order of the file's address space
>> mapping, making sure PMD_ORDER is supported.
>>
>> Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>
>> ---
>> mm/huge_memory.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>> index 970e077019b7..a22bb2364bdc 100644
>> --- a/mm/huge_memory.c
>> +++ b/mm/huge_memory.c
>> @@ -86,9 +86,6 @@ static inline bool file_thp_enabled(struct vm_area_struct *vma)
>> {
>> struct inode *inode;
>>
>> - if (!IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS))
>> - return false;
>> -
>> if (!vma->vm_file)
>> return false;
>>
>> @@ -97,6 +94,9 @@ static inline bool file_thp_enabled(struct vm_area_struct *vma)
>> if (IS_ANON_FILE(inode))
>> return false;
>>
>> + if (mapping_max_folio_order(inode->i_mapping) < PMD_ORDER)
>> + return false;
>> +
>> return !inode_is_open_for_write(inode) && S_ISREG(inode->i_mode);
>> }
>>
>
> I assume this change itself should be sufficient and the SCAN_FAIL check
> in patch #1 is not required?
>

Sure, I will remove that one.


Best Regards,
Yan, Zi