]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched: Add test_and_clear_wake_up_bit() and atomic_dec_and_wake_up()
authorNeilBrown <neilb@suse.de>
Wed, 25 Sep 2024 05:31:41 +0000 (15:31 +1000)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 7 Oct 2024 07:28:38 +0000 (09:28 +0200)
commit52d633def56c10fe3e82a2c5d88c3ecb3f4e4852
tree599972d1f266486685dcb75789d1c5eafd7257f5
parentbf39882edc798279765ca31751f6e679b50b97ef
sched: Add test_and_clear_wake_up_bit() and atomic_dec_and_wake_up()

There are common patterns in the kernel of using test_and_clear_bit()
before wake_up_bit(), and atomic_dec_and_test() before wake_up_var().

These combinations don't need extra barriers but sometimes include them
unnecessarily.

To help avoid the unnecessary barriers and to help discourage the
general use of wake_up_bit/var (which is a fragile interface) introduce
two combined functions which implement these patterns.

Also add store_release_wake_up() which supports the task of simply
setting a non-atomic variable and sending a wakeup.  This pattern
requires barriers which are often omitted.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240925053405.3960701-5-neilb@suse.de
include/linux/wait_bit.h