account_locked_vm(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… account_locked_vm(9) β€” from the Kernel API Manual, bestie 🫢

okay so bestie, real talk: this is account_locked_vm(9) out of the Linux Kernel API Manual, and it's lowkey one of those tiny functions that does one thing and does it slay. it's the little bookkeeper that keeps an mm's locked_vm counter honest. let me walk you through it πŸ’–


✨ NAME ✨

account_locked_vm β€” the girlie that accounts locked pages to an mm's locked_vm πŸ‘‘


🌸 SYNOPSIS 🌸

int account_locked_vm (struct mm_struct *mm , unsigned long pages , bool inc );

like, that's the whole glow-up right there. three args, one int return, periodt πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • mm β€” the mm you're accounting against, and bestie she may be NULL. yes, NULL is a valid vibe here.
  • pages β€” how many pages we're accounting. the number. the amount. the quantity.
  • inc β€” true if the pages should be considered positive, false if not. so like, are we adding to the counter or taking away from it? that's the whole question πŸ¦‹

πŸ’€ DESCRIPTION πŸ’€

okay so the one thing you NEED to know: this function assumes a non-NULL mm is valid β€” meaning it's got at least one reference on it. no cap, that's the contract. if mm is non-NULL and you handed it garbage, that's on you, not on her πŸ™ˆ


πŸ”₯ RETURN πŸ”₯

  • 0 β€” on success, or if mm is NULL. icon behaviour honestly. NULL mm just gets a chill 0 and nobody's upset ✨
  • -ENOMEM β€” if RLIMIT_MEMLOCK would be exceeded. that's the limit saying "ma'am, no" πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

kernel file: ./mm/util.c

and the whole friend group y'all should check out:


lowkey reminder bestie: -ENOMEM isn't a bug, it's RLIMIT_MEMLOCK doing its job. respect the limit 🫢

and that's the tea β˜• this one lives in ./mm and it's dated October 2026 β€” catch you in the next release, mwah πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from