work_grab_pending(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… work_grab_pending(9) β€” the Kernel API Manual entry you didn't know you needed

okay so bestie, this is a page from the Kernel API Manual and it's about work_grab_pending β€” the function that literally steals a work item off the worklist and disables irq while it's at it. not me being dramatic, that's just what it does 🫢


✨ NAME ✨

work_grab_pending β€” steal work item from worklist and disable irq πŸ’€πŸ”₯


πŸŽ€ SYNOPSIS πŸŽ€

bool work_grab_pending (struct work_struct *work , u32 cflags , unsigned
long *irq_flags );

like yes, it returns a bool, and yes, it's taking three arguments β€” she's a little high-maintenance but she's worth it πŸ’…


🌸 ARGUMENTS 🌸

  • work β€” the work item to steal. yeah. steal it. girlboss behaviour πŸ‘‘
  • cflags β€” the WORK_CANCEL_ flags. ship them with the right vibes or don't ship them at all ⭐
  • irq_flags β€” the place to store IRQ state. it's giving "put your keys here so you don't lose them" πŸŽ€

πŸ¦‹ DESCRIPTION πŸ¦‹

So the whole point: this function grabs the PENDING bit of work. and when we say work can be in any stable state, we mean it β€” idle, on timer, or on worklist. all of them. no cap ✨

You can call this from any context. literally any. and heads up bestie: IRQ is disabled on return, with the IRQ state stored in *irq_flags. so the caller is responsible for re-enabling it via local_irq_restore. that's on you, not on her πŸ™ˆ

It returns true if work was pending, and false if idle. simple. iconic. periodt πŸ’œ

⚠️ fr fr: don't forget the local_irq_restore β€” she disabled irq on the way out and she is NOT turning it back on for you.

🌈 SEE ALSO 🌈

Kernel file ./kernel/workqueue.c, plus literally the entire workqueue friend group β€” iykyk πŸ˜­πŸ’–


and that's the whole page bestie!! πŸ’– this lil entry lives in ./kernel and it's dated October 2026 β€” so yeah, she's from the future, main character energy fr fr 🧚✨ go grab that pending bit, restore those irqs, and slay πŸ’…πŸ“

πŸ“¦ where this page comes from