kvm_pgtable..._clear_young(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kvm_pgtable..._clear_young(9) β€” like, the Kernel API Manual, bestie ✨

okay so picture this: it's a Kernel API Manual page, the header situation is kvm_pgtable..._clear_young(9), and we're about to get into it. this one is lowkey about checking a flag and maybe wiping it. no cap. let's go 🫢


🌸 NAME 🌸

kvm_pgtable_stage2_test_clear_young β€” peeks at the access flag in a page-table entry, and if you're feeling spicy, clears it too. that's the whole vibe check πŸ’…


✨ SYNOPSIS ✨

bool kvm_pgtable_stage2_test_clear_young (struct kvm_pgtable *pgt , u64
addr , u64 size , bool mkold );

she returns a bool, she takes four things. iconic signature, honestly πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • pgt β€” the page-table structure, and it has to be one that was initialised by kvm_pgtable_stage2_init*(). like, don't hand her a random struct and expect magic, bestie 😭
  • addr β€” the intermediate physical address, aka how you point at the exact page-table entry you're talking about. it's giving "who's that" but for memory 🧚
  • size β€” how big the address range you're visiting is. yes, you can be nosy about more than one entry at a time πŸ’–
  • mkold β€” true if the access flag should be cleared. that's it, that's the toggle. she's simple like that πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

first thing's first: the offset of addr within a page gets straight-up ignored. not her problem, not her business, we don't see it πŸ™ˆ

what she actually does is test and conditionally clear the access flag for every valid, leaf page-table entry used to translate the range [addr, addr + size). so she walks the whole range, checks the flags, and clears them only when you asked her to. very considered, very methodical, main character energy fr fr πŸ”₯

⚠️ ok this is the important bit, don't skip it: it is the caller's responsibility to invalidate the TLB after calling this function, so the updated permissions are actually visible to the CPUs. she does the page-table part, you do the TLB part. teamwork, babes 🀝 if you skip it, that's on you, not her πŸ’€

🌈 RETURN 🌈

Returns true if any of the visited PTEs had the access flag set. even one. she only needs one little flag to be like "yep, found it" ⭐


πŸ’– SEE ALSO πŸ’–

the whole friend group, assembled 🫢 and also the kernel file ./arch/arm64/include/asm/kvm_pgtable.h:


and that's the whole page, bestie πŸ’« shoutout to ./arch/arm64/include/asm for hosting her, October 2026 for the timestamp, and kvm_pgtable..._clear_young(9) for being the name on the door πŸŽ€ go forth, clear some flags, flush that TLB, and slay πŸ’…βœ¨

πŸ“¦ where this page comes from