cpuhp_setup_state(9)
π cpuhp_setup_state(9) β the kernel API manual, bestie edition
okay so this is a page from the Kernel API Manual (yes, cpuhp_setup_state(9) herself, she's the main character of this doc) and she's about to teach you how to set up hotplug state callbacks and run the @startup callback while she's at it. no cap. let's go π
β¨ NAME β¨
cpuhp_setup_state β the one where you setup hotplug state callbacks and it calls the @startup callback for you. two things at once, multitasking queen π
πΈ SYNOPSIS πΈ
int cpuhp_setup_state (enum cpuhp_state state , const char *name , int
(*startup)(unsigned int cpu) , int (*teardown)(unsigned int cpu) );
literally just one function, four things to hand her, she handles the rest π«Ά
π ARGUMENTS π
stateβ the state you're installing these calls for. yes, the state is the vibe check here.nameβ the name of the callback. she'll use it in debug output so future-you can figure out who did this πstartupβ your startup callback function, orNULLif you don't need one. no pressure bestie.teardownβ your teardown callback function, orNULLif you don't need one either. equally optional, equally valid β¨
π¦ DESCRIPTION π¦
so what actually happens? she installs the callback functions, and then β and this is the iconic part β she invokes the startup callback on the online cpus which have already reached the state. not the offline ones, not the ones that haven't gotten there yet. just the online-and-already-there girlies. periodt. π
π₯ SEE ALSO π₯
the kernel file where all the lore lives:
Kernel file ./include/linux/cpuhotplug.h
and her whole friend group, all linked below, all slaying in their own ways:
cpuhp_setup_state_cpuslocked(9)cpuhp_setup_state_nocalls(9)cpuhp_setup_state_nocalls_cpuslocked(9)cpuhp_setup_state_multi(9)cpuhp_state_add_instance(9)cpuhp_state_add_instance_nocalls(9)cpuhp_state_add_instance_nocalls_cpuslocked(9)cpuhp_remove_state(9)cpuhp_remove_state_nocalls(9)cpuhp_remove_state_nocalls_cpuslocked(9)cpuhp_remove_multi_state(9)cpuhp_state_remove_instance(9)cpuhp_state_remove_instance_nocalls(9)
ngl that's the whole page. short, sweet, and she ate. πβ¨
anyway, this came to you from ./include/linux, dated October 2026 β and the page you just read is cpuhp_setup_state(9). k byeee, go register some callbacks 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