svn commit: r349943 - head/sys/arm64/arm64

Mark Johnston markj at FreeBSD.org
Fri Jul 12 15:24:26 UTC 2019


Author: markj
Date: Fri Jul 12 15:24:25 2019
New Revision: 349943
URL: https://svnweb.freebsd.org/changeset/base/349943

Log:
  Apply some light cleanup to uses of pmap_pte_dirty().
  
  - Check for ATTR_SW_MANAGED before anything else.
  - Use pmap_pte_dirty() in pmap_remove_pages().
  
  No functional change intended.
  
  Reviewed by:	alc
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Fri Jul 12 11:45:42 2019	(r349942)
+++ head/sys/arm64/arm64/pmap.c	Fri Jul 12 15:24:25 2019	(r349943)
@@ -2812,9 +2812,8 @@ pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset
 	 * update the dirty field of each of the superpage's constituent 4KB
 	 * pages.
 	 */
-	if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 &&
-	    (old_l2 & ATTR_SW_MANAGED) != 0 &&
-	    pmap_pte_dirty(old_l2)) {
+	if ((old_l2 & ATTR_SW_MANAGED) != 0 &&
+	    (nbits & ATTR_AP(ATTR_AP_RO)) != 0 && pmap_pte_dirty(old_l2)) {
 		m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK);
 		for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++)
 			vm_page_dirty(mt);
@@ -2920,8 +2919,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t
 			 * When a dirty read/write mapping is write protected,
 			 * update the page's dirty field.
 			 */
-			if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 &&
-			    (l3 & ATTR_SW_MANAGED) != 0 &&
+			if ((l3 & ATTR_SW_MANAGED) != 0 &&
+			    (nbits & ATTR_AP(ATTR_AP_RO)) != 0 &&
 			    pmap_pte_dirty(l3))
 				vm_page_dirty(PHYS_TO_VM_PAGE(l3 & ~ATTR_MASK));
 
@@ -3344,8 +3343,8 @@ validate:
 			/* same PA, different attributes */
 			pmap_load_store(l3, new_l3);
 			pmap_invalidate_page(pmap, va);
-			if (pmap_pte_dirty(orig_l3) &&
-			    (orig_l3 & ATTR_SW_MANAGED) != 0)
+			if ((orig_l3 & ATTR_SW_MANAGED) != 0 &&
+			    pmap_pte_dirty(orig_l3))
 				vm_page_dirty(m);
 		} else {
 			/*
@@ -4293,8 +4292,7 @@ pmap_remove_pages(pmap_t pmap)
 				/*
 				 * Update the vm_page_t clean/reference bits.
 				 */
-				if ((tpte & ATTR_AP_RW_BIT) ==
-				    ATTR_AP(ATTR_AP_RW)) {
+				if (pmap_pte_dirty(tpte)) {
 					switch (lvl) {
 					case 1:
 						for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++)


More information about the svn-src-all mailing list