mmget(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– mmget(9) β€” a Kernel API Manual moment πŸ’–

okay so bestie, you found the mmget(9) page from the Kernel API Manual and honestly? it's a little baddie. let's get into it 🫢


✨ NAME ✨

mmget β€” pin the address space associated with a &struct mm_struct.

like, you're literally telling that address space "you're not going anywhere, bestie" πŸ’…


✨ SYNOPSIS ✨

void mmget (struct mm_struct *mm );

✨ ARGUMENTS ✨

  • mm β€” the address space you wanna pin. that's it, that's the whole arg 🌸

✨ DESCRIPTION ✨

so the whole vibe here is: make sure that the address space of the given struct mm_struct doesn't go away. no cap. you're holding onto it so it stays put πŸ’–

but β€” and this is important β€” this does not protect against parts of the address space being modified or freed, however. so like, the space stays alive, but the stuff inside it can still get changed on you. it's giving "the building is still standing but someone's rearranging the furniture" 😭

🚨 never use this function to pin this address space for an unbounded/indefinite amount of time. fr fr, don't do it. this is a short-term commitment situation only.

and when you're done being obsessed with it, use mmput to release the reference acquired by mmget. don't just ghost it, okay? πŸ™ˆ

also, see also <Documentation/mm/active_mm.rst> for an in-depth explanation of mm_struct.mm_count vs mm_struct.mm_users. if you've ever wondered why there are two of them, that's the lore drop you need, iykyk πŸ‘‘


✨ SEE ALSO ✨

it lives over in the kernel file ./include/linux/sched/mm.h, and it's in very good company:


and that's the whole page, bestie, you ate it up πŸ’…βœ¨

sign-off szn: this one comes from ./include/linux/sched, and it's dated October 2026 β€” so mark your calendars, the mmget(9) era is now πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from