follow_page_mask(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ follow_page_mask(9) ✨

okay so bestie, this one's from the Kernel API Manual and it's literally the glow-up page for looking up page descriptors πŸ’… like, given a user-virtual address, it finds the struct page for you. no cap.


🌸 SYNOPSIS 🌸

struct page * follow_page_mask (struct vm_area_struct *vma , unsigned
long address , unsigned int flags , unsigned long *page_mask );

like yes, that's the whole signature, no shortcuts πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • vma β€” the vm_area_struct mapping address, aka where this whole thing lives πŸ—ΊοΈ
  • address β€” the virtual address you're looking up, the main character of the operation ⭐
  • flags β€” the flags that modify how the lookup behaves, lowkey the personality settings πŸ”§
  • page_mask β€” a pointer to the output page_mask, it's giving "I'll tell you when we're done" πŸ“€

πŸ’– DESCRIPTION πŸ’–

so flags can have FOLL_ flags set, and those are defined in <linux/mm.h> πŸ’« iykyk.

when you're getting an anonymous page and the caller has to trigger unsharing of a shared anonymous page first, -EMLINK is returned 😭 the caller should trigger a fault with FAULT_FLAG_UNSHARE set. and ngl, note that unsharing is only relevant with FOLL_PIN and !FOLL_WRITE β€” that's the vibe check right there 🫢

on output, page_mask is set according to the size of the page ✨


πŸ‘‘ RETURN πŸ‘‘

it returns the mapped struct page *, or NULL if no mapping exists, or an error pointer if there's a mapping to something not represented by a page descriptor (see also vm_normal_page) πŸ’€ like it's literally doing the most to be helpful.


🌈 SEE ALSO 🌈

all the Kernel file ./mm/gup.c besties, in the order the page lists them, periodt:


🫢 and that's the whole page, bestie β€” everything's here, nothing dropped, no details left on read.

okay and finally the sign-off: this lil beauty comes from ./mm, dated October 2026, and that's the tea πŸ“βœ¨ slay, go read gup.c now πŸ’œ

πŸ“¦ where this page comes from