arch___change_bit(9)
π arch___change_bit(9) π
ok so real talk β this is a page from the Kernel API Manual, section 9, and it's all about arch___change_bit. bestie, it toggles a bit in memory. that's the whole gig. and yes, the triple underscore is intentional, don't come for her π«Ά
β¨ NAME β¨
arch___change_bit β toggle a bit in memory π
lowkey the most straightforward name in the whole kernel. she does what she says.
π SYNOPSIS π
void arch___change_bit (unsigned long nr , volatile unsigned long *addr
);
like, that's it. that's the function. no cap. β¨
πΈ ARGUMENTS πΈ
nrβ the bit to change π― like, which bit are we flipping, bestieaddrβ the address to start counting from π this is where the counting begins
π¦ DESCRIPTION π¦
okay so here's the tea, and it's kind of a big deal β
Unlike change_bit, this function is non-atomic and may be reordered. π literally reordered. the compiler and the CPU are both allowed to shuffle things around on you.
and the consequence? if it's called on the same region of memory simultaneously, the effect may be that only one operation succeeds. π
that's a race condition, babe. two operations walk into the same memory at the same time and only one of them leaves. if you need atomicity, this is not the function β there's a whole other change_bit for that, iykyk.
so like, use her wisely. she's fast and she's chill but she is NOT a locks-and-atomicity girlie. π
π₯ SEE ALSO π₯
- Kernel file
./arch/sh/include/asm/bitops-op32.hπ arch___test_and_set_bit(9)arch___test_and_clear_bit(9)
go read those too, they're giving sibling energy π
and that's the page!! mwah π
cute little sign-off for the footer stans: this iconic lil doc lives under ./arch/sh/include/asm, it's dated October 2026, and yeah β she's still arch___change_bit(9) in the header, we love consistency. πβ¨π
π¦ 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