diff options
author | 2019-02-01 21:48:48 +0000 | |
---|---|---|
committer | 2019-02-01 21:48:48 +0000 | |
commit | ac6c83e3853a2bd228616440aa80c80fee83e1b8 (patch) | |
tree | 28a4b649ad1bce8033a866769d56f834d4a07fd0 | |
parent | free size for wscons_event; ok deraadt@ visa@ (diff) | |
download | wireguard-openbsd-ac6c83e3853a2bd228616440aa80c80fee83e1b8.tar.xz wireguard-openbsd-ac6c83e3853a2bd228616440aa80c80fee83e1b8.zip |
Properly account wired pages in pmap_randomize_level
This change fixes a regress test failure noticed by bluhm@.
ok deraadt
-rw-r--r-- | sys/arch/amd64/amd64/pmap.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index ed9388d721e..21f6cf14c41 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.127 2019/01/21 06:18:37 mlarkin Exp $ */ +/* $OpenBSD: pmap.c,v 1.128 2019/02/01 21:48:48 mlarkin Exp $ */ /* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */ /* @@ -882,8 +882,12 @@ pmap_randomize_level(pd_entry_t *pde, int level) memset((void *)old_pd_va, 0, PAGE_SIZE); pg = PHYS_TO_VM_PAGE(old_pd_pa); - if (pg) - uvm_pagefree(pg); + if (pg) { + pg->wire_count--; + pmap_kernel()->pm_stats.resident_count--; + if (pg->wire_count <= 1) + uvm_pagefree(pg); + } for (i = 0; i < NPDPG; i++) if (new_pd_va[i] & PG_FRAME) |