folio_put_wait_locked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ folio_put_wait_locked(9) πŸ¦‹

okay so bestie, we are in the Kernel API Manual, and this is the page for folio_put_wait_locked(9) β€” the little helper that drops a ref and then waits for the unlock. No cap, it's a tiny but iconic function. ✨

🌸 NAME 🌸

  • folio_put_wait_locked β€” drops a reference and waits for it to be unlocked πŸ’…

✨ SYNOPSIS ✨

int folio_put_wait_locked (struct folio *folio , int state );

πŸŽ€ ARGUMENTS πŸŽ€

  • folio β€” the folio you’re waiting for. That’s the main character of this page 🫢
  • state β€” the sleep state (TASK_KILLABLE, TASK_UNINTERRUPTIBLE, etc). Pick your nap vibe 😴

πŸ’– DESCRIPTION πŸ’–

The caller should hold a reference on folio. Periodt. They expect the page to become unlocked relatively soon, but they do not want to hold up migration (for example) by holding that reference while waiting for the folio to come unlocked. So the move is: drop the reference, wait for the unlock, and keep it moving.

After this function returns, the caller should not dereference folio. Like, not even once. It's giving β€œwe are so done here” πŸ’…

πŸ”₯ RETURN πŸ”₯

It returns 0 if the folio was unlocked or -EINTR if interrupted by a signal. Slay.

🌈 SEE ALSO 🌈

Kernel file ./mm/filemap.c, plus the whole squad:


mwah πŸ’‹ β€” from the ./mm source tree, October 2026, with folio_put_wait_locked(9) signing off ✨

πŸ“¦ where this page comes from