filemap_cachestat(9)
π filemap_cachestat β like, the filemap one, from the Kernel API Manual
okay bestie, so this one is filemap_cachestat and it's literally the glow-up for your page cache stats. no cap, it's niche but it eats. π¦
β¨ SYNOPSIS β¨
void filemap_cachestat (struct address_space *mapping , pgoff_t
first_index , pgoff_t last_index , struct cachestat *cs );
it returns void, so it's giving "no return value, the answer's in the struct" energy. very main character. π
π ARGUMENTS π
mappingβ the mapping you're computing the stats for. like, the whole entire vibe you're inspecting, bestie. β¨first_indexβ the starting page cache index. where we begin, periodt. π«Άlast_indexβ the final page index, and yes it's inclusive β she's included, she counts. πcsβ thecachestatstruct that the result gets written into. this is where the tea gets poured. π
πΈ DESCRIPTION πΈ
so here's the thing: this queries the page cache statistics of a mapping, but only in the page range of [first_index, last_index] β and that range is inclusive, okurrr. π
and what's in the stats, you ask? the number of dirty pages, the number of pages marked for writeback, and the number of (recently) evicted pages. that's the whole trio. iconic. π
ngl, "recently" is doing a lil wink there in the parentheses, so keep that exactly as is β that's the source's wording, not mine. π
π¦ SEE ALSO π¦
Kernel file ./mm/filemap.c β and then the whole friend group, fr fr:
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_release_folio(9), filemap_invalidate_inode(9) π
like, that's forty-plus besties. i'm obsessed, lowkey. π§
bestie reminder: everything above is straight from the page itself β i didn't invent a single flag, index, or type. if you're touching mapping, you already know what you're doing. iykyk. π
and that's the whole page, babes. sign-off time: this lil baddie lives in the ./mm directory, is dated October 2026, and goes by filemap_cachestat(9). slay, go read your page cache stats responsibly. πβ¨π
π¦ 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