softleaf_en...it_on_locked(9)
π softleaf_entry_wait_on_locked(9) β the kernel API manual, but make it make sense π
okay so bestie, pull up a chair, because we're reading a kernel API manual page together and honestly? it's giving "waiting room energy" but in the good way. this is the softleaf_en...it_on_locked(9) page (yes the header truncates it like that, the kernel is dramatic π
), from the Kernel API Manual.
β¨ NAME β¨
softleaf_entry_wait_on_locked β literally just: wait for a migration entry or a device_private entry to be removed. that's the whole vibe. it waits. it's patient. main character energy π°οΈ
πΈ SYNOPSIS πΈ
void softleaf_entry_wait_on_locked (softleaf_t entry , spinlock_t *ptl
);
yep that's the signature, copy it exactly, no cap π«Ά
π ARGUMENTS π
entryβ a migration swap entry or adevice_privateswap entry. that's the thing we're waiting on, bestie.ptlβ an already lockedptl. heads up: this function will drop the lock. it takes the lock from your hands and lets go of it, so don't go assuming you still hold it after, okay? π
π¦ DESCRIPTION π¦
So here's the tea β: this function waits for a migration entry that references the given page, or a device_private entry that references a dvice_private page (and yes, that's literally how it's spelled in the original β we don't fix, we report π), to be unlocked.
It is equivalent to:
folio_put_wait_locked(folio, TASK_UNINTERRUPTIBLE)
...with one iconic little difference: this one can be called without taking a reference on the page. obsessed. instead, you should call it while holding the ptl for the entry that references the page. that's the whole trick β¨
It returns after unlocking the ptl. so like, the unlock already happened by the time you get control back. not me warning you twice π
It follows the same logic as folio_wait_bit_common, so if you want the deep lore, go read the comments there. iykyk π
π SEE ALSO π
Kernel file ./mm/filemap.c, plus this whole friend group right here β every single one, no skips:
filemap_remove_folio(9)filemap_fdatawrite_range(9)filemap_flush_range(9)filemap_flush(9)filemap_range_has_page(9)filemap_fdatawait_range(9)filemap_fdatawait_range_keep_errors(9)file_fdatawait_range(9)filemap_fdatawait_keep_errors(9)filemap_write_and_wait_range(9)file_check_and_advance_wb_err(9)file_write_and_wait_range(9)replace_page_cache_folio(9)folio_put_wait_locked(9)folio_unlock(9)folio_end_read(9)folio_end_private_2(9)folio_wait_private_2(9)folio_wait_private_2_killable(9)folio_end_writeback_no_dropbehind(9)folio_end_writeback(9)__folio_lock(9)page_cache_next_miss(9)page_cache_prev_miss(9)__filemap_get_folio_mpol(9)find_get_entries(9)find_lock_entries(9)filemap_get_folios(9)filemap_get_folios_contig(9)filemap_get_folios_tag(9)filemap_get_folios_dirty(9)filemap_read(9)generic_file_read_iter(9)filemap_splice_read(9)mapping_seek_hole_data(9)filemap_fault(9)read_cache_folio(9)mapping_read_folio_gfp(9)read_cache_page_gfp(9)__generic_file_write_iter(9)generic_file_write_iter(9)filemap_release_folio(9)filemap_invalidate_inode(9)filemap_cachestat(9)
π quick reminder bestie: ptl comes in locked, and this function drops it. that's not a bug, that's the whole bit. don't double-unlock, don't touch it after. periodt π
and that's the page!! π source is ./mm, dated October 2026, and it lives in the Kernel API Manual β go forth, wait on your locked entries responsibly, and slay π§ββοΈβ¨πΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms