STRUCT CPUHP_CPU_STATE(9)
π struct cpuhp_cpu_state(9)
okay so bestie, this page comes from the Kernel API Manual (section 9, the kernel-internals girlies) and it's literally all about struct cpuhp_cpu_state β the per-CPU hotplug state storage. it's giving "where a CPU keeps its own little diary of what state it's in." no cap.
β¨ NAME β¨
struct cpuhp_cpu_state β per cpu hotplug state storage π«Ά
like, per CPU. each one gets their own. main character energy for every core.
πΈ SYNOPSIS πΈ
here's the whole vibe, exactly as it is, don't @ me:
struct cpuhp_cpu_state {
enum cpuhp_state state;
enum cpuhp_state target;
enum cpuhp_state fail;
#ifdef CONFIG_SMP;
struct task_struct *thread;
bool should_run;
bool rollback;
bool single;
bool bringup;
struct hlist_node *node;
struct hlist_node *last;
enum cpuhp_state cb_state;
int result;
atomic_t ap_sync_state;
struct completion done_up;
struct completion done_down;
#endif;
};
π¨ bestie look at that#ifdef CONFIG_SMP;β everything below it only exists whenCONFIG_SMPis set. no SMP, no thread field, no completions, nothing. she said "not today."
π Members π
like a group photo, one by one, no one left out:
stateβ the current cpu state. where she's at right now πββοΈtargetβ the target state. where she's trying to go. the goal. the vision board.failβ current CPU hotplug callback state. (yes it's namedfail, she's just built different π₯²)threadβ pointer to the hotplug thread. the one doing the actual work, honestly iconic.should_runβ thread should execute. a whole bool just to say "go bestie."rollbackβ perform a rollback. we're taking it back, no shame.singleβ single callback invocation. just one. a little solo moment.bringupβ single callback bringup or teardown selector. which direction are we going, up or down? selector energy.nodeβ remote CPU node; for multi-instance, do a single entry callback for install/remove.lastβ for multi-instance rollback, remember how far we got. the receipts πcb_stateβ the state for a single callback (install/uninstall).resultβ result of the operation. did we slay or did we flop, that's the whole field.ap_sync_stateβ state for AP synchronization.done_upβ signal completion to the issuer of the task for cpu-up. β¬οΈ done!done_downβ signal completion to the issuer of the task for cpu-down. β¬οΈ done!
π¦ SEE ALSO π¦
the whole friend group, in ./kernel/cpu.c:
struct cpuhp_step(9)cpuhp_invoke_callback(9)cpuhp_ap_update_sync_state(9)cpuhp_ap_report_dead(9)cpuhp_ap_sync_alive(9)clear_tasks_mm_cpumask(9)cpu_device_down(9)notify_cpu_starting(9)cpu_device_up(9)bringup_hibernate_cpu(9)__cpuhp_setup_state_cpuslocked(9)__cpuhp_remove_state_cpuslocked(9)
iykyk π
and that's the page!! sourced straight from ./kernel, dated October 2026 β β go off, kernel girlies, this one's for you π§π
π¦ 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