On Mon, Jan 29, 2024 at 03:09:31PM +0800, Kefeng Wang wrote: > In order to support poisoned folio copy recover from migrate folio, > let's use folio_mc_copy() and move it in the begin of the function > of __migrate_folio(), which could simply error handling since there > is no turning back if folio_migrate_mapping() return success, the > downside is the folio copied even though folio_migrate_mapping() > return fail, a small optimization is to check whether folio does > not have extra refs before we do more work ahead in __migrate_folio(), > which could help us avoid unnecessary folio copy. OK, I see why you've done it this way. Would it make more sense if we pulled the folio refcount freezing out of folio_migrate_mapping() into its callers? That way folio_migrate_mapping() could never fail.