free_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– free_pages(9) πŸ’–

okay so real talk, bestie β€” you're reading the free_pages page from the Kernel API Manual, and honestly? it's a whole vibe. let's get into it 🫢


✨ NAME ✨

free_pages β€” frees pages that were allocated with __get_free_pages(). that's it, that's the whole job, and she does it beautifully πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

void free_pages (unsigned long addr , unsigned int order );

look at her. two args. clean. iconic. ✨


🌸 ARGUMENTS 🌸

  • addr β€” the virtual address tied to a page that came back from __get_free_pages. like, the actual address you got handed. don't get cute with it πŸ’–
  • order β€” the order of the allocation. yes, the same one. you gotta tell her how big the thing was, she's not psychic 😭

πŸ¦‹ DESCRIPTION πŸ¦‹

so free_pages behaves the same as __free_pages β€” literally same energy, same result. the whole point of this one is: you use it when you only have a valid virtual address. that's your situation? she's your girl. 🌈

but listen β€” if you've got the page itself (like, the struct page), do not come here. call __free_pages instead. matching the right function to the thing you're actually holding is the whole game, ngl. πŸ”₯

πŸ’€ seriously, check what you're holding first. virtual address β†’ free_pages. page β†’ __free_pages. don't mix them up, bestie.

πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./mm/page_alloc.c, plus the whole friend group:

like, that's the group chat. go say hi 🧚


mwah πŸ’‹ this page came from ./mm, dated October 2026, and it's still signed free_pages(9) β€” go free responsibly, bestie πŸ“

πŸ“¦ where this page comes from