STRUCT SMP_HOTPLUG_THREAD(9)
β¨ NAME β¨
struct smp_hotplug_thread β the descriptor for a CPU-hotplug-related thread, straight out of the Kernel API Manual, bestie π
Like, it's literally the little info packet that tells the kernel everything it needs to know about a per-CPU thread: where to stash the task pointers, what to run, and what to do when a CPU ghosts you (goes offline) or comes back online. Iconic behavior tbh.
πΈ SYNOPSIS πΈ
struct smp_hotplug_thread {
struct task_struct * __percpu *store;
struct list_head list;
int (*thread_should_run)(unsigned int cpu);
void (*thread_fn)(unsigned int cpu);
void (*create)(unsigned int cpu);
void (*setup)(unsigned int cpu);
void (*cleanup)(unsigned int cpu, bool online);
void (*park)(unsigned int cpu);
void (*unpark)(unsigned int cpu);
bool selfparking;
const char *thread_comm;
};
π Members π
Okay so here's the whole cast of characters, no skips, no cap π
storeβ pointer to the per-CPU storage for the task pointers. It's giving "where did I put my keys" but for task structs πlistβ the list head for core management. Lowkey just the plumbing that keeps everything organized π§΅thread_should_runβ the vibe check function: it checks whether the thread should run or not. Heads up though β it gets called with preemption disabled, so no funny business π€thread_fnβ the associated thread function. This is the main character, the actual work πcreateβ optional setup function, called when the thread gets created. Important: it is not called from the thread context, so don't get it twisted πsetupβ optional setup function, called when the thread gets operational for the first time. First-day-of-school energy πcleanupβ optional cleanup function, called when the thread should stop (i.e. on module exit). Say bye bestie πparkβ optional park function, called when the thread is parked (CPU offline). Nap time πunparkβ optional unpark function, called when the thread is unparked (CPU online). Wakey wakey β¨selfparkingβ abool; means the thread is not parked by the park function. It handles its own parking, independent queen πthread_commβ the base name of the thread. That's its government name on the process list πͺͺ
π¦ SEE ALSO π¦
Kernel file ./include/linux/smpboot.h β go read it, iykyk π«Ά
And that's the whole page bb! Straight from ./include/linux, dated October 2026, and filed under struct smp_hotplug_thread(9). Slay, go write some hotplug threads ππ₯
π¦ 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