diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 07a00963004..2d2e673e762 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -10423,6 +10423,13 @@ pmap_quick_enter_page(vm_page_t m) return (PHYS_TO_DMAP(paddr)); mtx_lock_spin(&qframe_mtx); KASSERT(*vtopte(qframe) == 0, ("qframe busy")); + + /* + * Since qframe is exclusively mapped by us, and we do not set + * PG_G, we can use INVLPG here. + */ + invlpg(qframe); + pte_store(vtopte(qframe), paddr | X86_PG_RW | X86_PG_V | X86_PG_A | X86_PG_M | pmap_cache_bits(kernel_pmap, m->md.pat_mode, 0)); return (qframe); @@ -10435,14 +10442,6 @@ pmap_quick_remove_page(vm_offset_t addr) if (addr != qframe) return; pte_store(vtopte(qframe), 0); - - /* - * Since qframe is exclusively mapped by - * pmap_quick_enter_page() and that function doesn't set PG_G, - * we can use INVLPG here. - */ - invlpg(qframe); - mtx_unlock_spin(&qframe_mtx); }