STRUCT SMP_CALL_ON_CPU_STRUCT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct smp_call_on_cpu_struct β€” NAME

ok so listen bestie: struct smp_call_on_cpu_struct is literally the whole vibe β€” it's the struct you use to Call a function on a specific CPU ✨ (yes that's the official job description, no cap).

this is from the Kernel API Manual, in case you were wondering where the lore comes from πŸŽ€


🌸 SYNOPSIS

struct smp_call_on_cpu_struct {
    struct work_struct      work;
    struct completion       done;
    int (*func)(void *);
    void *data;
    int ret;
    int cpu;
 };

πŸ¦‹ Members

  • work β€” a work_struct, aka the little work item that carries this whole operation. it's giving "the actual doer" energy πŸ’…
  • done β€” a completion to signal. this is your "we're so back" notification, the thing that tells everybody the call finished 🫢
  • func β€” function to call. the main character, fr fr β€” it takes a void * and hands you back an int πŸ‘‘
  • data β€” the function's data argument. whatever lil payload you're passing along to func πŸ“
  • ret β€” the return value from func. whatever func decided to give back gets parked right here πŸ“₯
  • cpu β€” the target CPU, and heads up: -1 means any CPU, so pick that if you're feeling flexible ✨

πŸ’– Description

ok so the tea β˜•: this struct is used to call a function on a specific cpu and wait for it to return. like, you dispatch it, and then you sit there and wait, because patience is a virtue and also the whole design πŸ”₯

optionally, you can also make sure the call is done on a specified physical cpu via vcpu pinning β€” which is the move when you wanna support virtualized environments 🧚 no cap, that's the whole point of that part.


πŸ” SEE ALSO

Kernel file ./kernel/smp.c β€” and the whole friend group πŸ’œ:


and that's the whole page, bestie β€” go call a function on a CPU, you absolute icon 🌈

sign-off era πŸŽ€: this one lives in ./kernel, stamped October 2026. periods, slay, mwah πŸ’‹
πŸ“¦ where this page comes from