arch___change_bit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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, bestie
  • addr β€” 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 πŸ”₯

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