filemap_release_folio(9)
β¨ filemap_release_folio(9) β¨
okay so real talk, this is a page straight out of the Kernel API Manual β filemap_release_folio(9) β and it's literally about letting go of the extra little secrets a folio is holding onto. bestie, this is the breakup talk of the mm subsystem πβ¨
πΈ NAME πΈ
filemap_release_folio β release fs-specific metadata on a folio. that's it, that's the whole vibe: folio says "i'm done", and this function helps it drop the extra stuff (filesystem-specific metadata) it was clinging to. π
π¦ SYNOPSIS π¦
bool filemap_release_folio (struct folio *folio , gfp_t gfp );
she takes two things and gives you back a bool. iconic signature ngl π
π ARGUMENTS π
folioβ The folio which the kernel is trying to free. like, the actual main character folio that's about to get yeeted out of memory π«Άgfpβ Memory allocation flags (and I/O mode). yes, it's the flag bag β it tells you whether I/O is allowed and whether you're allowed to block. details below, keep reading π
π§ DESCRIPTION π§
So the address_space is trying to release any data attached to a folio β presumably the stuff chilling at folio->private. that's the whole mission: free the folio, let go of whatever extra baggage it stored in private. πβ‘οΈποΈ
This will also be called if the private_2 flag is set on a page. that flag is basically a little sticky note saying "hey, this folio has other metadata associated with it too" β so yeah, this gets invoked then as well. iykyk. π
And the gfp argument? she's the one specifying the rules of the call, specifically:
- whether I/O may be performed to release this page β that's
__GFP_IO - whether the call may block β that's
__GFP_RECLAIM&__GFP_FS
so lowkey gfp is the vibe check for "can we do I/O?" and "are we allowed to sleep here?" π΄π₯
β RETURN β
trueif the release was successful π- otherwise
falseπ
periodt. that's the whole return contract.
π SEE ALSO π
the whole friend group, no cap β all from the Kernel file ./mm/filemap.c:
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)softleaf_entry_wait_on_locked(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_invalidate_inode(9)filemap_cachestat(9)
like, the entire mm squad showed up to the group chat ππ
ok but for real β this page lives in ./mm, dated October 2026. so when you're citing her, that's the receipts. π«Άβ¨ π
π¦ 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