Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jun 2019 17:29:48 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r348642 - stable/12/sys/riscv/riscv
Message-ID:  <201906041729.x54HTmFl098081@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Jun  4 17:29:47 2019
New Revision: 348642
URL: https://svnweb.freebsd.org/changeset/base/348642

Log:
  MFC r340159 (by jhb):
  Rework setting PTE_D for kernel mappings.

Modified:
  stable/12/sys/riscv/riscv/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/riscv/pmap.c
==============================================================================
--- stable/12/sys/riscv/riscv/pmap.c	Tue Jun  4 17:29:20 2019	(r348641)
+++ stable/12/sys/riscv/riscv/pmap.c	Tue Jun  4 17:29:47 2019	(r348642)
@@ -2010,13 +2010,20 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v
 		new_l3 |= PTE_W;
 	if ((va >> 63) == 0)
 		new_l3 |= PTE_U;
-	else if (prot & VM_PROT_WRITE)
-		new_l3 |= PTE_D;
 
 	new_l3 |= (pn << PTE_PPN0_S);
 	if ((flags & PMAP_ENTER_WIRED) != 0)
 		new_l3 |= PTE_SW_WIRED;
-	if ((m->oflags & VPO_UNMANAGED) == 0)
+
+	/*
+	 * Set modified bit gratuitously for writeable mappings if
+	 * the page is unmanaged. We do not want to take a fault
+	 * to do the dirty bit accounting for these mappings.
+	 */
+	if ((m->oflags & VPO_UNMANAGED) != 0) {
+		if (prot & VM_PROT_WRITE)
+			new_l3 |= PTE_D;
+	} else
 		new_l3 |= PTE_SW_MANAGED;
 
 	CTR2(KTR_PMAP, "pmap_enter: %.16lx -> %.16lx", va, pa);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906041729.x54HTmFl098081>