___set_bit(9)
π ___set_bit(9) β from the Kernel API Manual, bestie π
okay so. we're doing bitops today and honestly? this one's a lil gremlin. it's the non-atomic cousin and you need to know that going in. stay with me π«Ά
β¨ NAME β¨
___set_bit β set a bit in memory π₯
(three underscores. yes, THREE. count 'em. it matters, iykyk π)
πΈ SYNOPSIS πΈ
void ___set_bit (unsigned long nr , volatile unsigned long *addr );
that's the whole vibe. void return, nothing to check, no drama π
π¦ ARGUMENTS π¦
nrβ the bit to set, bestie. which one? that one. π―addrβ the address to start counting from π
π DESCRIPTION π
okay so here's the tea, and it's important tea β
Unlike set_bit, this function is non-atomic and may be reordered. like. it's fast and it's giving "i trust you to know what you're doing" energy. no locks, no barriers, no safety net π
and here's the part where you gotta pay attention: if it's called on the same region of memory simultaneously, the effect may be that only one operation succeeds. so likeβ¦ if two of your threads roll up to the same memory at the same time, you might lose a bit. not "might error out", not "might warn you" β you just quietly lose the update π that's the whole hazard. so please, for the love of everything, don't be out here racing this thing unless you actually know it's safe π
lowkey the non-atomic part is the entire personality of this function. don't forget it. don't "fix" it by pretending it's atomic. it is not. periodt π
β SEE ALSO β
- Kernel file
./tools/include/asm-generic/bitops/non-atomic.hβ the source of truth, go read it π§ ___change_bit(9)___test_and_set_bit(9)___test_and_clear_bit(9)_test_bit(9)
(notice the underscores, they're all matching the non-atomic family. one underscore, three underscores β they are NOT the same function, don't @ me π go check each one fr fr)
that's the whole page, bestie, you ate it π this lil icon came from ./tools/include/asm-generic/bi... and it's dated October 2026, so likeβ¦ future knowledge, we love that for us π¦ slay β¨π
π¦ 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