Re: [PATCH] mm: migrate: requeue destination folio on deferred split queue

From: Matthew Wilcox

Date: Fri Mar 06 2026 - 11:13:37 EST


On Fri, Mar 06, 2026 at 05:12:38PM +0300, Usama Arif wrote:
> + /*
> + * Record whether the source folio is on the deferred split queue
> + * before move_to_new_folio(), which unqueues it via
> + * __folio_migrate_mapping().
> + */
> + if (folio_test_large(src) && folio_test_large_rmappable(src) &&
> + !data_race(list_empty(&src->_deferred_list)))

Why do you need data_race() here? list_empty() contains a READ_ONCE()
so shouldn't be necessary?

> + old_page_state |= PAGE_WAS_ON_DEFERRED_SPLIT;

You've done a great job of the naming. So much so that the comment
seems entirely unnecessary?

> + /*
> + * Requeue the destination folio on the deferred split queue if
> + * the source was on the queue. The source is unqueued in
> + * __folio_migrate_mapping(), so we record and check the state
> + * from before move_to_new_folio().
> + */
> + if (old_page_state & PAGE_WAS_ON_DEFERRED_SPLIT)
> + deferred_split_folio(dst, false);

Again, I'm not sure the comment says anything that the code doesn't?