clear_nonpresent_ptes(9)
π clear_nonpresent_ptes(9)
okay so real talk β this is a page straight out of the Kernel API Manual, section 9 (the kernel-functions girlypop section, iykyk). And the function it's hyping up? clear_nonpresent_ptes. Say it with me. It's a whole mouthful but she's worth it. π«Ά
β¨ NAME β¨
clear_nonpresent_ptes β clears multiple non-present PTEs that are consecutive in the pgtable. That's it. That's the whole gig. A little cleanup crew for a lil run of PTEs that are all, collectively, not present. πβ¨
πΈ SYNOPSIS πΈ
void clear_nonpresent_ptes (struct mm_struct *mm , unsigned long addr ,
pte_t *ptep , unsigned int nr );
no cap, she returns void and takes four things. We'll get to those. π
π¦ ARGUMENTS π¦
okay bestie, four args, let's meet them one by one:
mmβ the address space that these ptes represent. she's the context, the main character energy of memory management. πaddrβ the address of the first pte. like, where the party starts. πptepβ the page table pointer for the first entry. your lil finger pointing at the beginning of the row. πnrβ the number of entries to clear. how many of them are getting the β¨treatmentβ¨. literally just a count. π’
π₯ CONTEXT π₯
before you call her, vibe check the room:
- the caller holds the page table lock. non-negotiable. do not come in here unlocked, fr fr. π
- the PTEs are all not present. all of them. every single one. that's the whole premise. π
- the PTEs are all in the same PMD. same PMD, same vibe. don't try to sneak one from a different PMD in there. π«
honestly if any of those three things aren't true, you're not in the right context for this function, and that's on you, not her. π
π SEE ALSO π
the full squad β and yes, she's friends with all of them:
- 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)ptep_try_set(9)flush_tlb_before_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)
like, that's the group chat. read the whole thread. π§
and that's the page!! source lives over in ./include/linux and this particular glow-up is dated October 2026 β mwah, iconic, no notes. ππ see you at the next man 9 bestie π
π¦ 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