Re: [PATCH v5] mm: memory: fix truncation removing mapped folios

From: David Hildenbrand (Arm)

Date: Tue Oct 27 2026 - 09:01:36 EST


On 10/27/26 13:50, Baolin Wang wrote:
>
>
> On 10/27/26 6:55 PM, David Hildenbrand (Arm) wrote:
>> On 10/27/26 11:35, Baolin Wang wrote:
>>>
>>>
>>>
>>> Sure.
>>>
>>>
>>> IMHO, I'm not a big fan of adding two pmd_none() checks just to avoid an
>>> uncommon concurrent sync.
>>
>> It's what we already had. We had to: one for handling pmd_none() directly and
>> one for handling zapping while splitting (file THPs).
>>
>> We just managed to let the second also handle the final piece of the former.
>>
>> Anyhow, let's get this fixed.
>>
>> If you think the code is clearer your way (where I disagree)
>
> Fair enough. Though I have a different taste, I'd still like to make the
> maintainer happy.

Don't worry, it's hard to make me unhappy :)

(just a bit overloaded right now)

> I'll send out v6 tomorrow following your suggestion.
>

That looks good. Are you planning on following up with the memory barrier
optimization for smaller folios?

I hope below doesn't end up in some performance degradation.


--
Cheers,

David