vmpressure_register_event(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… vmpressure_register_event (kernel API manual, bestie!) πŸ’…

okay so real talk, this one's from the Kernel API Manual and it's genuinely such a vibe once you get what it's doing. sit down, grab a strawberry, we're linking memory pressure to an eventfd and it's gonna slay πŸ“βœ¨

🌸 NAME 🌸

vmpressure_register_event β€” bind vmpressure notifications to an eventfd πŸ’–

like, that's literally it. that's the whole thing. notifications β†’ eventfd. iconic behavior.


⭐ SYNOPSIS ⭐

int vmpressure_register_event (struct mem_cgroup *memcg , struct
eventfd_ctx *eventfd , const char *args );

no cap, that's the exact signature, character for character, don't come for me 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • memcg β€” the mem_cgroup that's interested in vmpressure notifications. this is the main character of the operation tbh πŸ‘‘
  • eventfd β€” the eventfd_ctx we're linking notifications with. the messenger bestie πŸ’Œ
  • args β€” the event arguments: a pressure level threshold, plus an optional mode. yes it's a string, yes it's parsed, we'll get to it 🌈

πŸŽ€ DESCRIPTION πŸŽ€

so what this function does is associate that eventfd context with the vmpressure infrastructure, so the notifications get delivered to the eventfd. literally the whole point. slay πŸ’…

the args parameter is a comma-delimited string that denotes a pressure level threshold β€” one of vmpressure_str_levels, i.e. "low", "medium", or "critical" β€” and an optional mode, which is one of vmpressure_str_modes, i.e. "hierarchy" or "local".

that's the tea: threshold first, mode optional. iykyk 🧚

also important: to be used as an memcg event method. periodt.

πŸ”₯ RETURN πŸ”₯

  • 0 on success πŸŽ‰
  • -ENOMEM on memory failure 😭
  • -EINVAL if args could not be parsed πŸ’€

ngl the -EINVAL one is giving "check your comma string, bestie" energy. vibe check your args before you call this fr fr πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./mm/memcontrol-v1.c, plus these icons:


and that's the whole page, bestie 🫢 this one lives over in ./mm and it's dated October 2026 β€” shoutout to the source/version and date, we love a documented footer ✨🌸 go forth and register those events πŸ’–

πŸ“¦ where this page comes from