mmgrab(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ mmgrab(9) β€” Kernel API Manual, bestie edition πŸ’…

okay so welcome to mmgrab(9), aka the Kernel API Manual page that's about to make pinning a &struct mm_struct make sense πŸ’–


✨ NAME ✨

mmgrab β€” Pin a &struct mm_struct. Periodt πŸ’…


🌈 SYNOPSIS 🌈

void mmgrab (struct mm_struct *mm );

πŸ’… ARGUMENTS πŸ’…

  • mm β€” The struct mm_struct to pin. That's the whole argument, bestie 🫢

πŸŽ€ DESCRIPTION πŸŽ€

Okay so the main character job here: make sure mm will not get freed even after the owning task exits. No cap, that's the whole point πŸ’€

🚨 Important vibe check: this doesn't guarantee that the associated address space will still exist later on. Before you access it, mmget_not_zero has to be used. Periodt.

This is a preferred way to pin mm for a longer/unbounded amount of time. Slay, that's literally what it's for ✨

When you're done and you need to release the reference acquired by mmgrab, use mmdrop β€” don't leave it hanging, bestie πŸ’…

Also see <Documentation/mm/active_mm.rst> for an in-depth explanation of mm_struct.mm_count vs mm_struct.mm_users. iykyk πŸ¦‹


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/linux/sched/mm.h:


mwah πŸ’‹ β€” source/version ./include/linux/sched, date October 2026, page mmgrab(9). bye bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from