Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2018 21:04:30 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342099 - head/sys/riscv/riscv
Message-ID:  <201812142104.wBEL4UJI003182@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Fri Dec 14 21:04:30 2018
New Revision: 342099
URL: https://svnweb.freebsd.org/changeset/base/342099

Log:
  Avoid needless TLB invalidations in pmap_remove_pages().
  
  pmap_remove_pages() is called during process termination, when it is
  guaranteed that no other CPU may access the mappings being torn down.
  In particular, it unnecessary to invalidate each mapping individually
  since we do a pmap_invalidate_all() at the end of the function.
  
  Also don't call pmap_invalidate_all() while holding a PV list lock, the
  global pvh lock is sufficient.
  
  Reviewed by:	jhb
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D18562

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

Modified: head/sys/riscv/riscv/pmap.c
==============================================================================
--- head/sys/riscv/riscv/pmap.c	Fri Dec 14 21:03:01 2018	(r342098)
+++ head/sys/riscv/riscv/pmap.c	Fri Dec 14 21:04:30 2018	(r342099)
@@ -2721,9 +2721,10 @@ pmap_remove_pages(pmap_t pmap)
 				l3 = pmap_l2_to_l3(l2, pv->pv_va);
 				tl3 = pmap_load(l3);
 
-/*
- * We cannot remove wired pages from a process' mapping at this time
- */
+				/*
+				 * We cannot remove wired pages from a
+				 * process' mapping at this time.
+				 */
 				if (tl3 & PTE_SW_WIRED) {
 					allfree = 0;
 					continue;
@@ -2742,7 +2743,6 @@ pmap_remove_pages(pmap_t pmap)
 				    (uintmax_t)tl3));
 
 				pmap_load_clear(l3);
-				pmap_invalidate_page(pmap, pv->pv_va);
 
 				/*
 				 * Update the vm_page_t clean/reference bits.
@@ -2771,9 +2771,9 @@ pmap_remove_pages(pmap_t pmap)
 			free_pv_chunk(pc);
 		}
 	}
-	pmap_invalidate_all(pmap);
 	if (lock != NULL)
 		rw_wunlock(lock);
+	pmap_invalidate_all(pmap);
 	rw_runlock(&pvh_global_lock);
 	PMAP_UNLOCK(pmap);
 	vm_page_free_pages_toq(&free, false);



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