page_pgoff(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 of PAGE_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 πŸ’œ


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