Re: [PATCH gmem FIXUP] mm, compaction: make testing mapping_unmovable() safe

From: kirill . shutemov
Date: Fri Sep 01 2023 - 18:55:06 EST


On Fri, Sep 01, 2023 at 10:20:26AM +0200, Vlastimil Babka wrote:
> As Kirill pointed out, mapping can be removed under us due to
> truncation. Test it under folio lock as already done for the async
> compaction / dirty folio case. To prevent locking every folio with
> mapping to do the test, do it only for unevictable folios, as we can
> expect the unmovable mapping folios are also unevictable - it is the
> case for guest memfd folios.
>
> Also incorporate comment update suggested by Matthew.
>
> Fixes: 3424873596ce ("mm: Add AS_UNMOVABLE to mark mapping as completely unmovable")
> Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>

Superficially looks good to me. But I don't really understand this
code path to Ack.

--
Kiryl Shutsemau / Kirill A. Shutemov