sb_start_pagefault(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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