page_pgoff(9)
π page_pgoff(9) β from the Kernel API Manual, bestie
okay so this page is literally about page_pgoff, which calculates the logical page offset of this page. that's the whole vibe. it lives in the Kernel API Manual and we're gonna get into it β¨
πΈ NAME πΈ
page_pgoff β calculate the logical page offset of this page. that's it, that's the job π
β¨ SYNOPSIS β¨
pgoff_t page_pgoff (const struct folio *folio , const struct page *page
);
look at her. two consts, one return type, zero notes. iconic π«Ά
π¦ ARGUMENTS π¦
folioβ the folio that's holding this page. your container, your home base πpageβ the page whose offset we're out here trying to find. yes her specifically π
π DESCRIPTION π
okay so this is where it gets specific and you gotta pay attention, bestie:
- for file pages, this is the offset from the beginning of the file, measured in units of
PAGE_SIZE. - for anonymous pages, this is the offset from the beginning of the
anon_vma, also in units ofPAGE_SIZE. - and for KSM pages? yeah no, this will return nonsense. literally nonsense. don't come for me, that's just what the page says π
π₯ CONTEXT π₯
the caller must have a reference on the folio, or otherwise prevent it from being split or freed. no cap β that's a hard requirement, not a suggestion. hold your reference, bestie π
π RETURN π
the offset, in units of PAGE_SIZE. simple. clean. slay β
π§ SEE ALSO π§
so many friends, all from the kernel file ./include/linux/pagemap.h. go say hi π
filemap_set_wb_err(9)filemap_check_wb_err(9)filemap_sample_wb_err(9)file_sample_sb_err(9)mapping_set_error(9)mapping_set_large_folios(9)mapping_align_index(9)mapping_pmd_folio_support(9)folio_flush_mapping(9)folio_inode(9)folio_attach_private(9)folio_change_private(9)folio_detach_private(9)fgf_t(9)fgf_set_order(9)write_begin_get_folio(9)filemap_get_folio(9)filemap_lock_folio(9)filemap_grab_folio(9)find_get_page(9)find_lock_page(9)find_or_create_page(9)grab_cache_page_nowait(9)folio_next_index(9)folio_next_pos(9)folio_file_page(9)folio_contains(9)folio_pos(9)linear_page_delta(9)linear_page_index(9)linear_anon_page_index(9)folio_trylock(9)folio_lock(9)lock_page(9)folio_lock_killable(9)filemap_range_needs_writeback(9)struct readahead_control(9)page_cache_sync_readahead(9)page_cache_async_readahead(9)readahead_folio(9)readahead_pos(9)readahead_length(9)readahead_index(9)readahead_count(9)readahead_batch_length(9)folio_mkwrite_check_truncate(9)i_blocks_per_folio(9)
ngl, that's a whole group chat of cross-references and every single one of them made the list. no skips, no cuts π
and that's the page!! this one came out of ./include/linux, dated October 2026, and it's still filed under page_pgoff(9) β go off, king πβ¨π
π¦ 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