cpuhp_setup_state(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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, or NULL if you don't need one. no pressure bestie.
  • teardown β€” your teardown callback function, or NULL if 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:


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