On Wed, Apr 10, 2024 at 06:27:38PM -0700, Jane Chu wrote: > On 4/10/2024 4:15 PM, Jane Chu wrote: > > > On 4/10/2024 3:21 AM, Oscar Salvador wrote: > > > > > On Mon, Apr 08, 2024 at 05:34:29PM -0700, Jane Chu wrote: > > > > At this stage, 'p' is not expected to be a large page since a > > > > _refcount has > > > > been taken, right? So is it reasonable to replace the "if > > > > (retry)" block > > > > with a VM_BUG_ON warning? otherwise, if 'p' became part of a different > > > > large folio, how to recover from here ? > > > We might have split the THP (if it was part of), but AFAICS > > > nothing stops the kernel to coallesce this page again into a new THP > > > via e.g: > > > madvise(MADV_HUGEPAGE) ? > > > > Good point, thanks! > > Come to think of it a bit more, maybe the check could be > > if (folio_test_large(folio) || (folio != page_folio(p))) { > > ? Because, 'p' could have become part of a THP after shake_folio() and > before folio_lock(), right? What is the mechanism for reassembling a large folio? I don't see that code anywhere.