raw_seqcount_begin(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_seqcount_begin πŸ’…

okay so real talk, this is the Kernel API Manual entry for raw_seqcount_begin, and it's a whole vibe β€” it's the ✨no-frills✨ version of starting a seqcount read section. buckle up bestie πŸŽ€


🌸 NAME 🌸

raw_seqcount_begin β€” begin a seqcount_t read critical section w/o lockdep and w/o counter stabilization 🫢

like, no lockdep, no stabilization. she's minimal, she's fast, she's giving main character energy πŸ’…


✨ SYNOPSIS ✨

raw_seqcount_begin (s );

that's it. that's the whole call. iconic πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • s β€” Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants. literally any of them, she's flexible like that 🧚

πŸ”₯ DESCRIPTION πŸ”₯

so raw_seqcount_begin opens a read critical section of the given seqcount_t. simple. BUT β€” and this is the part you gotta clock β€” unlike read_seqcount_begin, this function will not wait for the count to stabilize. none of that waiting-around energy. πŸ™ˆ

if a writer is active when it begins, it will fail the read_seqcount_retry at the end of the read critical section instead of stabilizing at the beginning of it. so the check just gets yeeted to the end instead of the start. the way that works!! 😭

⚠️ ok now listen β€” use this only in special kernel hot paths where the read section is small and has a high probability of success through other external means. like, it's not a casual everyday thing, it's a hot path thing. periodt.

what do you get for all that risk? it will save a single branching instruction. one. literally one instruction. and she ate, honestly πŸ’€πŸ”₯


πŸ‘‘ RETURN πŸ‘‘

count to be passed to read_seqcount_retry ⭐

(you get your count back, and you hand it right over to read_seqcount_retry at the end. that's the whole trade. iykyk)


🌈 SEE ALSO 🌈

Kernel file ./include/linux/seqlock.h β€” and bestie, she has a whole friend group, so let's meet them πŸ’œ:


and that's the page!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ sourced from ./include/linux, dated October 2026 β€” ty bestie, mwah, go read your seqlocks responsibly πŸ«ΆπŸ’œπŸ‘‘

πŸ“¦ where this page comes from