STRUCT OBJPOOL_HEAD(9)
π 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 tosizeof(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 ofnum_possible_cpus. it's a little saved copy so nobody has to go ask again, iykyk πcapacityβ max objs that one singleobjpool_slotcan manage. per-slot limit, respect it πgfpβ thegfpflags used forkmalloc&vmalloc. this is the "how do we allocate" mood ring β¨refβ therefcountof 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 ofobjpool_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 π₯
- Kernel file
./include/linux/objpool.hβ the header itself, the mothership struct objpool_slot(9)objpool_init(9)objpool_pop(9)objpool_push(9)objpool_drop(9)objpool_free(9)objpool_fini(9)
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
- 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