sb_start_pagefault(9)
β¨ sb_start_pagefault β¨
okay so bestie, this is a page from the Kernel API Manual, and honestly? it's giving "tiny function, huge responsibilities" π like she's small but she is not the side character here.
πΈ NAME πΈ
sb_start_pagefault β get write access to a superblock from a page fault π«Ά
π¦ SYNOPSIS π¦
void sb_start_pagefault (struct super_block *sb );
π ARGUMENTS π
sbβ the super we write to βοΈ (yes, that's the whole vibe, that's the whole argument)
π DESCRIPTION π
okay so picture this: a process starts handling a write page fault, right? and it needs to embed the whole operation into an sb_start_pagefault β sb_end_pagefault pair so it gets exclusion against file system freezing. fr fr, you can't skip this step. why? because the page fault is literally about to dirty a page, and that's a whole thing π₯
so what does this function actually do? it increments the number of running page faults β that's the thing that prevents freezing from happening while you're mid-fault. and if the file system is already frozen? no stress, she waits until the file system is thawed. she's patient like that π
lowkey important: since page fault freeze protection behaves as a lock, users have to preserve the ordering of freeze protection and other filesystem locks. this is not optional, bestie β it's a lock, it acts like a lock, treat it like a lock π
it is advised to put sb_start_pagefault close to mmap_lock in lock ordering. the page fault handling code implies this lock dependency π
mmap_lock -> sb_start_pagefault
β SEE ALSO β
Kernel file ./include/linux/fs/super.h, plus the whole friend group: __sb_write_started(9), sb_write_started(9), sb_write_not_started(9), sb_end_write(9), sb_end_pagefault(9), sb_end_intwrite(9), sb_start_write(9), sb_start_intwrite(9) π
and that's the tea π this whole page lives in ./include/linux/fs and it was dated October 2026 β iconic, timeless, periodt ππ§
π¦ 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