clear_and_wake_up_bit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ clear_and_wake_up_bit(9) ✨

okay so this is a page from the Kernel API Manual (section 9, kernel girlies rise 🫢) and it's literally about clearing one (1) bit and then being like "hey everyone waiting on this, wake up bestie" πŸ’–


🌸 NAME 🌸

clear_and_wake_up_bit β€” clear a bit and wake up anyone waiting on that bit

no cap, that's the whole job. it's giving "lights off, party's over, but politely" πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

void clear_and_wake_up_bit (int bit , unsigned long *word );

void function, no return value, we love a low-stakes king πŸ‘‘


πŸ’… ARGUMENTS πŸ’…

  • bit β€” the bit of the word being waited on. like, which little guy are we clearing. be specific.
  • word β€” the address containing the bit being waited on. yes, an unsigned long *, the address itself, not the value. she needs the address fr fr.

🌈 DESCRIPTION 🌈

The designated bit is cleared and any tasks waiting in wait_on_bit or similar will be woken. so you clear it, and everyone who was napping in the wait queue gets the notification. main character move honestly.

This call has RELEASE semantics so that any changes to memory made before this call are guaranteed to be visible after the corresponding wait_on_bit completes. this part is important bestie β€” it's not just "wake up lol", it's "wake up AND everything I wrote down before I flipped the bit is actually readable now". the memory-ordering guarantee is the moment. iykyk ✨

honestly if you skip the RELEASE semantics part you're missing the whole point of the function, that's the actual slay here πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux/wait_bit.h β€” go read it, the whole friend group lives there πŸ’œ

the wait-y girlies:

the variable-waiting girlies:

the waking-up girlies:

and the clear-and-wake cousins:

literally a whole friend group, obsessed πŸ˜­πŸ’…


and that's the page!! πŸ“ this lil cutie lives in ./include/linux, dated October 2026, and that's the sign-off β€” mwah, go clear some bits responsibly bestie πŸ§šπŸ’–β­

πŸ“¦ where this page comes from