read_seqlock_excl_irqsave(9)
π read_seqlock_excl_irqsave(9) β kernel API manual, bestie edition π
okay so picture this: you're deep in the kernel, in a seqlock_t situation, and you need a reader section that absolutely will not be interrupted. that's this function. it's from the kernel API manual and it's lowkey iconic. let's go β¨
πΈ NAME πΈ
read_seqlock_excl_irqsave β start a non-interruptible seqlock_t locking reader section. yes bestie, non-interruptible. she does not budge π
β¨ SYNOPSIS β¨
read_seqlock_excl_irqsave (lock , flags );
that's it. two args. tiny function, big responsibilities π«Ά
π ARGUMENTS π
lockβ pointer toseqlock_t. that's your seqlock, your main character, the whole vibe π₯flagsβ stack-allocated storage for saving the caller's local interrupt state. and listen: you HAVE to pass this toread_sequnlock_excl_irqrestore. it's giving "matched set, do not separate" π
π¦ DESCRIPTION π¦
so this is the _irqsave variant of read_seqlock_excl. same energy, extra interrupt-safety garnish β¨
π¨ real talk though β use this only if the seqlock_t write side section, or other read sections, can be invoked from a hardirq context. note the italics, bestie, they're doing heavy lifting. "or other read sections" is not a suggestion, it's a whole clause π
if none of that applies to you? then this is not your girl. pick a cheaper variant and slay responsibly π
π SEE ALSO π
the kernel file is ./include/linux/seqlock.h, and honestly the whole seqlock extended family showed up to the group chat. every single one of them:
seqcount crew π§
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)raw_seqcount_begin(9)__read_seqcount_retry(9)read_seqcount_retry(9)
write side seqcount π
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)
latch era π
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 setup π
classic read side β
write seqlock, all the flavours π
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)
exclusive read side π
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_sequnlock_excl_irqrestore(9)
the or-lock besties π¦
read_seqbegin_or_lock(9)need_seqretry(9)done_seqretry(9)read_seqbegin_or_lock_irqsave(9)done_seqretry_irqrestore(9)
and finally πΈ
π btw bestie β don't forget your unlock. read_sequnlock_excl_irqrestore is literally right there in the list. this function only opens the section; closing it is your job, and the kernel will not be gentle about it. no cap π
anyway that's the whole page! this one comes to you courtesy of ./include/linux, dated October 2026, and it's filed under read_seqlock_excl_irqsave(9) β go forth, save those interrupts, and remember: irqsave implies irqrestore. periodslay π
β¨π
π¦ 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