gmap_helper_...t_pte_unused(9)
π gmap_helper_...t_pte_unused(9) β from the Kernel API Manual, bestie π
okay so this is a whole manpage from the Kernel API Manual and it's genuinely kinda iconic β we're talking about gmap_helper_try_set_pte_unused, a little s390 helper that does exactly one thing and does it well. listen up π«Ά
β¨ NAME β¨
gmap_helper_try_set_pte_unused β the way this function's whole personality is marking a pte entry as unused. that's it. that's the job. no cap π
πΈ SYNOPSIS πΈ
void gmap_helper_try_set_pte_unused (struct mm_struct *mm , unsigned
long vmaddr );
like, it returns void (nothing back, she's not a gossip) and takes two args. slay β¨
π¦ ARGUMENTS π¦
mmβ bestie, this is the mm. thestruct mm_struct *. that's the whole description, no notes πvmaddrβ the userspace address whose pte is to be marked. that's the one getting the glow-up (or rather, the un-glow-up) β
π DESCRIPTION π
so what it does is: it marks the pte corresponding to the given address as unused. and why do we care? because this makes core mm code just drop this page instead of swapping it. literally β drop it, don't swap it. bye page ππ
and here's the part where you gotta pay attention, bestie, because this is the vibe check that matters π
This function needs to be called with interrupts disabled (for example while holding a spinlock), or while holding the mmap lock. can't stress this enough π«Ά
Normally this function is called as a result of an unmap operation, and thus KVM common code will already hold kvm->mmu_lock in write mode. so lowkey the locking just works out β but only because the caller set it up that way. iykyk π
π₯ CONTEXT π₯
Needs to be called while holding the mmap lock or with interrupts disabled. no exceptions, she's strict about this one π
π SEE ALSO π
- the kernel file
./arch/s390/mm/gmap_helpers.c try_get_locked_pte(9)gmap_helper_zap_one_page(9)gmap_helper_discard(9)gmap_helper_disable_cow_sharing(9)
go read those too, they're all in the same friend group π§π
and that's the page!! it lives under ./arch/s390/mm, dated October 2026 β so like, mark your calendars bestie πβ¨ bye!! π
π¦ 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