read_cache_page_gfp(9)
π read_cache_page_gfp β kernel API manual, but make it make sense π
okay so bestie, you're reading the page for read_cache_page_gfp, and honestly? it's giving "small function, big responsibilities." let's get into it π«Ά
β¨ SYNOPSIS β¨
struct page * read_cache_page_gfp (struct address_space *mapping ,
pgoff_t index , gfp_t gfp );
three args, one struct page * coming back at you. no cap. πΈ
π ARGUMENTS π
mappingβ the page'saddress_space. like, which address space are we even doing this in, bestie? this one.indexβ the page index. yes, the index. go find your page. πgfpβ the page allocator flags to use if allocating. these are your flags, you picked them, you own them. π
π DESCRIPTION π
so this is literally the same as "read_mapping_page(mapping, index, NULL)", except any new page allocations get done using the allocation flags you specify. same vibe, your flags. β¨
if the page does not get brought uptodate, it returns -EIO. not great, not terrible, but definitely not the slay outcome. π
also β important, bestie β the function expects mapping->invalidate_lock to be already held when you call it. like, it's not gonna grab it for you. you gotta walk in with it. π
fr fr, hold the lock before you call this. the function is not doing the lock chores for you, that's not its job.
π¦ RETURN π¦
- up to date page on success β iconic, we love a win π
ERR_PTRon failure β not the moment, but okay π
π₯ SEE ALSO π₯
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)__generic_file_write_iter(9)generic_file_write_iter(9)filemap_release_folio(9)filemap_invalidate_inode(9)filemap_cachestat(9)
like, that's a whole friend group. mwah. π§
and that's the page, bestie π this one came out of ./mm and it's dated October 2026 β so go forth, pass your gfp flags, hold your invalidate_lock, 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