STRUCT OBJPOOL_HEAD(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct objpool_head(9) πŸ’–

okay so real talk, bestie β€” welcome to struct objpool_head(9), straight out of the Kernel API Manual (section 9, kernel-space gang πŸ‘‘). this is the glow-up page for object pooling metadata, and honestly? it's giving backstage-pass energy. everything the pool needs to know about itself lives in this one little struct. let's get into it πŸŽ€


✨ NAME ✨

struct objpool_head β€” the object pooling metadata. that's it, that's the vibe. it's the struct that holds all the receipts for an object pool πŸ§ΎπŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

periodt, here's the literal shape of it β€” no cap, copy it exactly:

struct objpool_head {
    int obj_size;
    int nr_objs;
    int nr_possible_cpus;
    int capacity;
    gfp_t gfp;
    refcount_t ref;
    unsigned long           flags;
    struct objpool_slot   **cpu_slots;
    objpool_fini_cb release;
    void *context;
 };

lowkey obsessed with how tidy that is. look at those members lined up like a friend group photo πŸ“Έ


🌸 Members 🌸

okay bestie, field-by-field tour, main-character energy only:

  • obj_size β€” the size of one object, and it's aligned to sizeof(void *). yes, the alignment is not optional, the kernel does NOT do unaligned behaviour, we stan a struct that lines up πŸ’«
  • nr_objs β€” total objs, like, the whole headcount. these are the ones "to be pre-allocated with objpool" 🫢
  • nr_possible_cpus β€” a cached value of num_possible_cpus. it's a little saved copy so nobody has to go ask again, iykyk πŸ™ˆ
  • capacity β€” max objs that one single objpool_slot can manage. per-slot limit, respect it πŸ’…
  • gfp β€” the gfp flags used for kmalloc & vmalloc. this is the "how do we allocate" mood ring ✨
  • ref β€” the refcount of the objpool. classic refcount behaviour, keep it balanced or things get 😭
  • flags β€” flags for objpool management. that's the official description, no extra clues, don't ask me for more πŸŽ€
  • cpu_slots β€” pointer to the array of objpool_slot. the tap-in point for the per-cpu squad 🌈
  • release β€” the resource cleanup callback. it's the "we're wrapping up, clean your room" function 🧹
  • context β€” caller-provided context. it's your stuff, you bring it, you own it πŸ“
ngl these are the actual one-liners from the page β€” I'm not out here inventing kernel behaviour, that's not the move πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

go read these next, bestie, they're literally the rest of the lore πŸ”₯

it's a whole ecosystem, not just one page. ate and left no crumbs πŸ’œ


and that's the whole thing, bestie 🫢 mwah πŸ’‹ β€” this page came from the ./include/linux source tree, dated October 2026, and it's filed as struct objpool_head(9). go forth and pool those objects responsibly βœ¨πŸŒΈπŸ’…

πŸ“¦ where this page comes from