flush_tlb_before_set(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… flush_tlb_before_set(9) β€” the Kernel API Manual, bestie edition πŸŽ€

okay so real talk, this one lives in the Kernel API Manual and it's called flush_tlb_before_set. the whole personality of this function is: the TLB has to forget the old thing before you're allowed to write the new thing. no cap. πŸ¦‹


✨ NAME ✨

flush_tlb_before_set β€” invalidate a kernel PTE's TLB before you re-set it πŸ’«

like, literally the function name is the function. it's giving "say what you do, do what you say."


🌸 SYNOPSIS 🌸

void flush_tlb_before_set (unsigned long addr );

πŸŽ€ ARGUMENTS πŸŽ€

  • addr β€” the kernel virtual address whose PTE was just cleared 🧹 (yes, just cleared β€” this is a timing thing, we live in the moment)

πŸ’– DESCRIPTION πŸ’–

so some architectures β€” arm64 being the icon it is β€” are not here for the one-step glow-up. you can't just repoint a live page-table entry at a different page in one move. the old entry has to be made invalid first, and its translation has to get flushed out of every TLB, and only then may the new entry be written. strict order, no shortcuts, periodt. πŸ‘‘

fr fr, this is a "do it in this exact sequence or things get weird" situation.

this is only for the lockless atomic kernel-PTE installers (ptep_try_set). like, that's the entire friend group it hangs out with, don't invite it to other parties. πŸ™ˆ

and it must be callable with interrupts disabled. that's not a suggestion, bestie, that's the contract. πŸ’€


🫢 SEE ALSO 🫢

that's the whole group chat, go say hi πŸ’œ


⭐ and that's the page! ⭐ it ships from ./include/linux, October 2026, and it is β€” and I cannot stress this enough β€” flush_tlb_before_set(9). mwah. πŸ’…πŸ“πŸ§š

πŸ“¦ where this page comes from