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

From: Baolin Wang

Date: Tue Oct 27 2026 - 09:06:39 EST




On 10/27/26 8:53 PM, David Hildenbrand (Arm) wrote:
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.

Thanks.

Are you planning on following up with the memory barrier
optimization for smaller folios?

If I can find some time, though I have quite a few pending TODOs now :). I don't think this is urgent, so if no one else picks it up, I'll add it to my TODO list.

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

This is not a common case, so I think it's fine.