summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/pmap.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2017-02-26 18:17:12 +0000
committeralc <alc@FreeBSD.org>2017-02-26 18:17:12 +0000
commite699ebd5d8a25277de419ba6fc22023c64dbf06f (patch)
treef1f33ee31cb1438d6943fb0648f1d02fee0fcab1 /sys/amd64/amd64/pmap.c
parent239438d580b5f8247e175bebd34c2a5a1377015f (diff)
downloadFreeBSD-src-e699ebd5d8a25277de419ba6fc22023c64dbf06f.zip
FreeBSD-src-e699ebd5d8a25277de419ba6fc22023c64dbf06f.tar.gz
MFC r313960
In pmap_enter(), set the PG_MANAGED flag on the new PTE in one place, rather two places, and do so before the pmap lock is acquired.
Diffstat (limited to 'sys/amd64/amd64/pmap.c')
-rw-r--r--sys/amd64/amd64/pmap.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 2e2b1e1..d0b1eed 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -4367,7 +4367,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
if ((m->oflags & VPO_UNMANAGED) != 0) {
if ((newpte & PG_RW) != 0)
newpte |= PG_M;
- }
+ } else
+ newpte |= PG_MANAGED;
mpte = NULL;
@@ -4440,11 +4441,9 @@ retry:
/*
* No, might be a protection or wiring change.
*/
- if ((origpte & PG_MANAGED) != 0) {
- newpte |= PG_MANAGED;
- if ((newpte & PG_RW) != 0)
- vm_page_aflag_set(m, PGA_WRITEABLE);
- }
+ if ((origpte & PG_MANAGED) != 0 &&
+ (newpte & PG_RW) != 0)
+ vm_page_aflag_set(m, PGA_WRITEABLE);
if (((origpte ^ newpte) & ~(PG_M | PG_A)) == 0)
goto unchanged;
goto validate;
@@ -4461,8 +4460,7 @@ retry:
/*
* Enter on the PV list if part of our managed memory.
*/
- if ((m->oflags & VPO_UNMANAGED) == 0) {
- newpte |= PG_MANAGED;
+ if ((newpte & PG_MANAGED) != 0) {
pv = get_pv_entry(pmap, &lock);
pv->pv_va = va;
CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, pa);
OpenPOWER on IntegriCloud