Re: [PATCH] mm/migrate: fix stale partially_mapped arg to deferred_split_folio()
From: David Hildenbrand (Arm)
Date: Wed Apr 01 2026 - 06:12:58 EST
On 4/1/26 10:41, Deepanshu Kartikey wrote:
> In migrate_folio_move(), src_partially_mapped is sampled from the source
> folio before move_to_new_folio() is called:
>
> if (folio_order(src) > 1 &&
> !data_race(list_empty(&src->_deferred_list))) {
> src_deferred_split = true;
> src_partially_mapped = folio_test_partially_mapped(src);
> }
>
> A concurrent thread can unmap pages from the source folio between this
> read and the actual migration, making the sampled value stale.
Trying to make sense of this.
In migrate_folio_move() don't we have the folio completely unmapped
because there are only migration entries referencing the folio?
See migrate_folio_unmap(), where we check !folio_mapped().
Why should we suddenly have mapped folio here? Something is off.
Unmapping a migration entry will not involve rmap code and not mess with
the partially-mapped flag.
--
Cheers,
David