sync_clear_bit(9)
π sync_clear_bit β a.k.a. the Kernel API Manual moment
okay so bestie, welcome to sync_clear_bit(9), straight out of the Kernel API Manual β¨ this one's a tiny little function with a big main-character job: it clears a bit in memory. that's it. that's the vibe. let's get into it π
β¨ NAME β¨
sync_clear_bit β Clears a bit in memory π§Ήπ«
πΈ SYNOPSIS πΈ
void sync_clear_bit (long nr , volatile unsigned long *addr );
like, look at her. so short. so iconic. π
π¦ ARGUMENTS π¦
nrβ the bit you're clearing, bestie π― that's the one getting yeeted to zero.addrβ the address you start counting from πΊοΈ like, where the counting begins, fr fr.
π DESCRIPTION π
so here's the tea π: sync_clear_bit is atomic and may not be reordered. no cap, it's locked in like that. π
BUT β and this is the important part, don't skip it β it does not contain a memory barrier π so if you're out here using it for locking purposes, you should call smp_mb__before_atomic and/or smp_mb__after_atomic in order to ensure changes are visible on other processors. that's the whole deal, iykyk π«Ά
lowkey do not forget the barrier calls if you're locking, bestie. the function will not do it for you and that's on periodt π
π₯ SEE ALSO π₯
- Kernel file
./arch/x86/include/asm/sync_bitops.hπ sync_set_bit(9)sync_change_bit(9)sync_test_and_set_bit(9)sync_test_and_clear_bit(9)sync_test_and_change_bit(9)
the whole sync_bitops friend group, honestly. go say hi π
okay that's the page!! mwah π this lil cutie lives in ./arch/x86/include/asm, dated October 2026, and she's filed under sync_clear_bit(9) β go clear some bits for me, bestie, and slay responsibly ππβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms