queue_work_on(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… queue_work_on(9) β€” like, the Kernel API Manual, bestie ✨

okay so real talk: this is a page straight out of the Kernel API Manual, and it's about pinning a work item to one specific CPU. It's short, it's spicy, and there are two whole ways to get yourself splatted. Let's go 🫢


🌸 SYNOPSIS 🌸

bool queue_work_on (int cpu , struct workqueue_struct *wq , struct
work_struct *work );

yes that's the whole signature, she's not long, she's just precise πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • cpu β€” the CPU number you want the work to actually execute on. this is the whole personality of the function ngl.
  • wq β€” the workqueue you're using. your queue. your vibe. your responsibility.
  • work β€” the work item being queued. the lil task itself 🐣

πŸ’– DESCRIPTION πŸ’–

So what we're doing here is queuing the work onto a specific CPU, and the caller β€” that's you, bestie β€” must ensure that CPU can't go away. That's the deal. That's the assignment. No cap.

And if you don't? If you fail to make sure that specified CPU can't disappear? Then it'll just execute on a randomly chosen CPU instead. Surprise! Chaos! A little roulette wheel of scheduling πŸ™ˆ

⚠️ but note well, okay β€” callers specifying a CPU that never has been online will get a splat. Not a warning. Not a gentle nudge. A splat. So maybe check that CPU exists first?? just a thought πŸ’€

⭐ RETURN ⭐

  • false β€” if the work was already on a queue (been there, done that, she's already booked).
  • true β€” otherwise. iconic behavior, work successfully queued πŸ‘‘

πŸ¦‹ SEE ALSO πŸ¦‹

First up, the source of truth: Kernel file ./kernel/workqueue.c πŸ’–

and then... the entire extended friend group. literally everyone. no gatekeeping here 🌈

like I said. everyone πŸ’€ but they're all baddies, read them 🫢


mwah πŸ’‹ that's the page. brought to you from ./kernel, all the way from October 2026 β€” see you in the next one, bestie βœ¨πŸŽ€

πŸ“¦ where this page comes from