Re: [PATCH v3 2/6] mm: gup: clarify a reason to check pte/pmd in gup_fast_pte_range()

From: David Hildenbrand (Arm)

Date: Wed Nov 11 2026 - 05:36:21 EST


On 11/10/26 04:50, Rik van Riel wrote:
> On Mon, 2026-11-09 at 12:32 +0000, Yeoreum Yun wrote:
>> Clarify a reason to check pte/pmd in gup_fast_pte_range().
>>
>> Signed-off-by: Yeoreum Yun <yeoreum.yun@xxxxxxx>
>> ---
>>  mm/gup.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/mm/gup.c b/mm/gup.c
>> index 7d43ce717b246..7f9348c633d58 100644
>> --- a/mm/gup.c
>> +++ b/mm/gup.c
>> @@ -2881,6 +2881,14 @@ static unsigned long gup_fast_pte_range(pmd_t
>> pmd, pmd_t *pmdp,
>>   if (!folio)
>>   goto pte_unmap;
>>  
>> + /*
>> + * Recheck the PTE after grabbing the folio to
>> detect concurrent
>> + * unmapping or protection changes such as by KSM.
>> + *
>> + * Also, recheck the PMD: THP collpase can detach
>> the PTE table
>
> collapse
>
>> + * while its entries remain unchaged. Checking the
>> PTE alone
>
> unchanged
>
>> + * would not dtect that we are walking a detached
>> page table.
>
> detect
>
> Other than that, Reviewed-by: Rik van Riel <riel@xxxxxxxxxxx>

yes, thanks!

Reviewed-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

A respin please (maybe tomorrow?)

--
Cheers,

David