raw_seqcount_begin(9)
π 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 toseqcount_tor any of theseqcount_LOCKNAME_tvariants. 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 π:
seqcount_init(9)SEQCNT_ZERO(9)__read_seqcount_begin(9)raw_read_seqcount_begin(9)read_seqcount_begin(9)raw_read_seqcount(9)raw_seqcount_try_begin(9)__read_seqcount_retry(9)read_seqcount_retry(9)raw_write_seqcount_begin(9)raw_write_seqcount_end(9)write_seqcount_begin_nested(9)write_seqcount_begin(9)write_seqcount_end(9)raw_write_seqcount_barrier(9)write_seqcount_invalidate(9)SEQCNT_LATCH_ZERO(9)seqcount_latch_init(9)raw_read_seqcount_latch(9)read_seqcount_latch(9)raw_read_seqcount_latch_retry(9)read_seqcount_latch_retry(9)raw_write_seqcount_latch(9)write_seqcount_latch_begin(9)write_seqcount_latch(9)write_seqcount_latch_end(9)seqlock_init(9)DEFINE_SEQLOCK(9)read_seqbegin(9)read_seqretry(9)write_seqlock(9)write_sequnlock(9)write_seqlock_bh(9)write_sequnlock_bh(9)write_seqlock_irq(9)write_sequnlock_irq(9)write_seqlock_irqsave(9)write_sequnlock_irqrestore(9)read_seqlock_excl(9)read_sequnlock_excl(9)read_seqlock_excl_bh(9)read_sequnlock_excl_bh(9)read_seqlock_excl_irq(9)read_sequnlock_excl_irq(9)read_seqlock_excl_irqsave(9)read_sequnlock_excl_irqrestore(9)read_seqbegin_or_lock(9)need_seqretry(9)done_seqretry(9)read_seqbegin_or_lock_irqsave(9)done_seqretry_irqrestore(9)scoped_seqlock_read(9)
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
- 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