flush_tlb_before_set(9)
π 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 π«Ά
- Kernel file
./include/linux/pgtable.h lazy_mmu_mode_enable(9)lazy_mmu_mode_disable(9)__task_lazy_mmu_mode_pause(9)lazy_mmu_mode_pause(9)__task_lazy_mmu_mode_resume(9)lazy_mmu_mode_resume(9)pte_batch_hint(9)set_ptes(9)clear_young_dirty_ptes(9)get_and_clear_full_ptes(9)get_and_clear_ptes(9)clear_full_ptes(9)clear_ptes(9)clear_nonpresent_ptes(9)ptep_try_set(9)wrprotect_ptes(9)clear_flush_young_ptes(9)test_and_clear_young_ptes(9)modify_prot_start_ptes(9)modify_prot_commit_ptes(9)pfnmap_setup_cachemode(9)pfnmap_track(9)pfnmap_untrack(9)pfnmap_setup_cachemode_pfn(9)
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
- 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