wait_on_bit_action(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… wait_on_bit_action (9) β€” like, the Kernel API Manual era πŸŽ€

okay bestie, so we're in the Kernel API Manual, section 9, and the star of the show is wait_on_bit_action. she waits. for a bit. to be cleared. that's the whole vibe. let's get into it ✨


✨ NAME ✨

wait_on_bit_action β€” literally just waiting for a bit to be cleared 🫢


🌸 SYNOPSIS 🌸

int wait_on_bit_action (unsigned long *word , int bit ,
wait_bit_action_f *action , unsigned mode );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • word β€” the address that's holding the bit we're waiting on. it's giving home address for your fav bit 🏠
  • bit β€” the actual bit at that address getting waited on. the main character of this whole operation πŸ‘‘
  • action β€” the function used to sleep, and ngl it may take special actions. it's not a regular sleep, it's a custom sleep πŸ’…
  • mode β€” the task state to sleep in. pick your nap vibe 😴

πŸ’– DESCRIPTION πŸ’–

so here's the tea: you wait for the given bit in an unsigned long or a bitmap (peep DECLARE_BITMAP) to be cleared. that's it, that's the job ✨

the clearing of the bit must be signalled with wake_up_bit, and lowkey it's often done as clear_and_wake_up_bit. no cap, this is required β€” don't skip the signal 🚨

this is similar to wait_on_bit, but it calls action instead of schedule for the actual waiting. so instead of the default snooze, you get your custom sleepy function πŸŒ™

the returned value will be zero if the bit was cleared β€” in which case the call has ACQUIRE semantics πŸ”₯ β€” or it'll be the error code returned by action, if that call returned non-zero. so like, two possible outcomes, both iconic πŸ’€

fr fr, remember: bit cleared = you get 0 and ACQUIRE semantics. action returned non-zero = you get that error code back. no guessing πŸ™ˆ

🌈 SEE ALSO 🌈

kernel file ./include/linux/wait_bit.h, plus the whole friend group:

wait_on_bit(9), wait_on_bit_io(9), wait_on_bit_timeout(9), wait_on_bit_lock(9), wait_on_bit_lock_io(9), wait_on_bit_lock_action(9), wait_var_event(9), wait_var_event_io(9), wait_var_event_killable(9), wait_var_event_timeout(9), wait_var_event_interruptible(9), wait_var_event_any_lock(9), wait_var_event_spinlock(9), wait_var_event_mutex(9), wake_up_var_protected(9), wake_up_var_locked(9), clear_and_wake_up_bit(9), test_and_clear_wake_up_bit(9), atomic_dec_and_wake_up(9), store_release_wake_up(9)


and that's the page, bestie 🫢 this one lives in ./include/linux and the date on it is October 2026 β€” so yeah, she's from the future, slay β­πŸ’œ bye!! πŸŽ€

πŸ“¦ where this page comes from