pwq_dec_nr_active(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pwq_dec_nr_active β€” a Kernel API Manual moment (section 9, bestie)

Okay so this is a page from the Kernel API Manual, and honestly it's one of those tiny little functions that does a huge amount of emotional (and scheduler) labor 🫢. Let's get into it.


🌸 NAME 🌸

pwq_dec_nr_active β€” retire an active count ✨

Like, it takes one (1) active count out of the group chat and quietly retires it. No drama, just bookkeeping πŸ’….


πŸ¦‹ SYNOPSIS πŸ¦‹

void pwq_dec_nr_active (struct pool_workqueue *pwq );

Returns void, so no surprises, no callback chaos, we love a low-stakes queen πŸ‘‘.


πŸŽ€ ARGUMENTS πŸŽ€

  • pwq β€” the pool_workqueue of interest. That's the one you're looking at. The main character, if you will πŸ‘€.

πŸ’– DESCRIPTION πŸ’–

So here's the vibe: this function decrements pwq's nr_active β€” yes, the count goes down by one, icon behavior β€” and then it tries to activate the first inactive work item πŸ”₯. Like, a slot just freed up, so it goes and taps the next work item on the shoulder and is like "you're up, bestie."

And here's the spicy part 🌢️: for unbound workqueues, this function may temporarily drop pwq->pool->lock. So the lock is not held for the whole ride β€” it lets go for a sec, which is exactly the kind of thing you want to know before you go assuming anything about locking around here, ngl 😭. That's a real caveat, so don't sleep on it.


⭐ SEE ALSO ⭐

Go read the source, and then go read all of these, because the cross-reference game here is genuinely unmatched β€” it's giving "linked list of knowledge" 🌈. The kernel file is ./kernel/workqueue.c, and the gang is:


Like, that's the whole workqueue cinematic universe in one SEE ALSO, and every single one of them is a real page β€” go click through them, iykyk πŸ’œ

🧚 sign-off 🧚

This lil beauty lives in ./kernel (yes, the source tree, mwah πŸ’‹), it's the October 2026 vintage, and its whole name-tag says pwq_dec_nr_active(9). Go forth, decrement responsibly, and remember: the lock might briefly dip out on unbound workqueues πŸ’€βœ¨ periodt.

πŸ“¦ where this page comes from