bpf_mem_cgroup_vm_events(9)
π bpf_mem_cgroup_vm_events(9) β¨
okay so real quick β this is a page from the Kernel API Manual, and it's about peeking at a memory cgroup's vm event counter. yes bestie, we're doing kernel internals today, and honestly? it's giving main character energy π
πΈ NAME πΈ
bpf_mem_cgroup_vm_events β literally just read a memory cgroup's vm event counter, that's the whole gig π«Ά
β SYNOPSIS β
__bpf_kfunc unsigned long bpf_mem_cgroup_vm_events (struct mem_cgroup
*memcg , enum vm_event_item event );
that's the signature, copy it exactly, no cap π
π¦ ARGUMENTS π¦
memcgβ the memory cgroup, aka the thing you're curious about πeventβ the event id, aka which counter you wanna see π―
β¨ DESCRIPTION β¨
okay so this one is lowkey simple and I'm obsessed: it lets you read memory cgroup event counters. that's it. that's the function. iconic behaviour, actually π
you hand it a memcg and an event id, and it goes and fetches you that counter. no drama, no side quests. periodt π
π RETURN π
it returns the current value of the corresponding events counter, as an unsigned long. so like, the number you asked for, fresh out of the cgroup β
π₯ SEE ALSO π₯
the kernel file lives at ./mm/bpf_memcontrol.c β that's where the magic happens, iykyk π§
and here's the whole friend group, all (9) sections, all worth a read:
bpf_get_root_mem_cgroup(9)bpf_get_mem_cgroup(9)bpf_put_mem_cgroup(9)bpf_mem_cgroup_usage(9)bpf_mem_cgroup_memory_events(9)bpf_mem_cgroup_page_state(9)bpf_mem_cgroup_flush_stats(9)
like yes, get you a kfunc family that supports you ππ
so yeah, that's the page bestie! it's from ./mm, dated October 2026 β future vibes, slay π¦ mwah, go read your memory cgroups responsibly π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms