STRUCT MEMORY_GROUP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 outside ZONE_MOVABLE of this memory group πŸ‘‘ so: the not-squishy part.
  • present_movable_pages β€” present (online) memory in ZONE_MOVABLE of 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 when memory_group.is_dynamic == false ⭐ it's the maximum number of pages we'll have in this static memory group.
  • d.unit_pages β€” valid only when memory_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 πŸ’€


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