On Tue, Feb 27, 2024 at 09:22:26PM -0500, Kent Overstreet wrote: > Which does raise the question of if we've ever attempted to define a > lock ordering on folios. I suspect not, since folio lock doesn't even > seem to have lockdep support. We even wrote it down! /* * To avoid deadlocks between range_cyclic writeback and callers * that hold pages in PageWriteback to aggregate I/O until * the writeback iteration finishes, we do not loop back to the * start of the file. Doing so causes a page lock/page * writeback access order inversion - we should only ever lock * multiple pages in ascending page->index order, and looping * back to the start of the file violates that rule and causes * deadlocks. */ (I'll take the AR to put this somewhere better like in the folio_lock() kernel-doc)