STRUCT MEMORY_GROUP(9)
π struct memory_group(9) π
okay so bestie, welcome to the Kernel API Manual page for struct memory_group and honestly? it's giving "the group chat that keeps your memory blocks organized" β¨ let's get into it π«Ά
πΈ NAME πΈ
struct memory_group β a logical group of memory blocks π
π¦ SYNOPSIS π¦
here's the whole lil struct, copy it exactly bestie, no typos:
struct memory_group {
int nid;
struct list_head memory_blocks;
unsigned long present_kernel_pages;
unsigned long present_movable_pages;
bool is_dynamic;
union {
struct {
unsigned long max_pages;
} s;
struct {
unsigned long unit_pages;
} d;
};
};
β Members β
nidβ the node id for all the memory blocks hanging out inside this memory group π₯ like, every single one of them, same node, no exceptions.memory_blocksβ a list of all the memory blocks that belong to this memory group π it's the membership roster, fr fr.present_kernel_pagesβ present (online) memory outsideZONE_MOVABLEof this memory group π so: the not-squishy part.present_movable_pagesβ present (online) memory inZONE_MOVABLEof this memory group π§ the movable besties.is_dynamicβ the memory group type, i.e. static vs. dynamic π¦ this one decides which half of the union you're allowed to love.{unnamed_union}β anonymous π it's an anonymous union, it has no name, it simply is. main character energy tbh.s.max_pagesβ valid only whenmemory_group.is_dynamic == falseβ it's the maximum number of pages we'll have in this static memory group.d.unit_pagesβ valid only whenmemory_group.is_dynamic == trueπ the unit, in pages, in which memory is added/removed in this dynamic memory group. this granularity defines the alignment of a unit in physical address space, and ngl it has to be at least as big as a single memory block π (not me stressing this, but like, it is a requirement).
β¨ Description β¨
so a memory group logically groups memory blocks together π« and each memory block belongs to at most one memory group β no double-dipping, we don't do that here π ββοΈ
a memory group corresponds to a memory device, like a DIMM or a NUMA node, which spans multiple memory blocks and might even span multiple non-contiguous physical memory ranges π iconic behavior honestly.
modification of members after registration is serialized by memory hot(un)plug code π so pls don't just go poking at it from anywhere, iykyk.
π SEE ALSO π
- Kernel file
./include/linux/memory.h memory_block_aligned_range(9)
that's the whole page bestie, you ate π
this lil gem lives in ./include/linux and it's dated October 2026 β so mark your calendar, mwah ππβ¨
π¦ 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