mbox series

[-V2,0/3] migrate_pages: fix deadlock in batched synchronous migration

Message ID 20230303030155.160983-1-ying.huang@intel.com (mailing list archive)
Headers show
Series migrate_pages: fix deadlock in batched synchronous migration | expand

Message

Huang, Ying March 3, 2023, 3:01 a.m. UTC
Two deadlock bugs were reported for the migrate_pages() batching
series.  Thanks Hugh and Pengfei.  Analysis shows that if we have
locked some other folios except the one we are migrating, it's not
safe in general to wait synchronously, for example, to wait the
writeback to complete or wait to lock the buffer head.

So 1/3 fixes the deadlock in a simple way, where the batching support
for the synchronous migration is disabled.  The change is
straightforward and easy to be understood.  While 3/3 re-introduce the
batching for synchronous migration via trying to migrate
asynchronously in batch optimistically, then fall back to migrate
synchronously one by one for fail-to-migrate folios.  Test shows that
this can restore the TLB flushing batching performance for synchronous
migration effectively.

Changelogs:

v2:

- Rebased on latest upstream.

- Restore the total retry number of synchronous migrations and removed
  "force" logic from migrate_folio_unmap().  Thanks Hugh!

- Revised some comments per Baolin's comment.  Thanks!

- Collected reviewed-by and tested-by.

Best Regards,
Huang, Ying