On 5/23/26 02:17, Ackerley Tng via B4 Relay wrote: > From: Ackerley Tng <[email protected]> > > When checking if a guest_memfd folio is safe for conversion, its refcount > is examined. A folio may be present in a per-CPU lru_add fbatch, which > temporarily increases its refcount. This can lead to a false positive, > incorrectly indicating that the folio is in use and preventing the > conversion, even if it is otherwise safe. The conversion process might not > be on the same CPU that holds the folio in its fbatch, making a simple > per-CPU check insufficient. > > To address this, drain all CPUs' lru_add fbatches if an unexpectedly high > refcount is encountered during the safety check. This is performed at most > once per conversion request. Draining only if the folio in question may be > lru cached. > > guest_memfd folios are unevictable, so they can only reside in the lru_add > fbatch. If the folio's refcount is still unsafe after draining, then the > conversion is truly deemed unsafe. > > Reviewed-by: Fuad Tabba <[email protected]> > Signed-off-by: Ackerley Tng <[email protected]>
Acked-by: Vlastimil Babka (SUSE) <[email protected]>
