svn commit: r189415 - head/sys/amd64/amd64

Alan Cox alc at FreeBSD.org
Thu Mar 5 10:11:27 PST 2009


Author: alc
Date: Thu Mar  5 18:11:26 2009
New Revision: 189415
URL: http://svn.freebsd.org/changeset/base/189415

Log:
  Make pmap_copy() more TLB friendly.  Specifically, make it use the kernel's
  direct map instead of the pmap's recursive mapping to access the lowest
  level in the page table.
  
  MFC after:	6 weeks

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

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Thu Mar  5 18:03:46 2009	(r189414)
+++ head/sys/amd64/amd64/pmap.c	Thu Mar  5 18:11:26 2009	(r189415)
@@ -3481,9 +3481,6 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm
 	if (dst_addr != src_addr)
 		return;
 
-	if (!pmap_is_current(src_pmap))
-		return;
-
 	vm_page_lock_queues();
 	if (dst_pmap < src_pmap) {
 		PMAP_LOCK(dst_pmap);
@@ -3545,14 +3542,16 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm
 			continue;
 		}
 
-		srcmpte = PHYS_TO_VM_PAGE(srcptepaddr & PG_FRAME);
+		srcptepaddr &= PG_FRAME;
+		srcmpte = PHYS_TO_VM_PAGE(srcptepaddr);
 		KASSERT(srcmpte->wire_count > 0,
 		    ("pmap_copy: source page table page is unused"));
 
 		if (va_next > end_addr)
 			va_next = end_addr;
 
-		src_pte = vtopte(addr);
+		src_pte = (pt_entry_t *)PHYS_TO_DMAP(srcptepaddr);
+		src_pte = &src_pte[pmap_pte_index(addr)];
 		while (addr < va_next) {
 			pt_entry_t ptetemp;
 			ptetemp = *src_pte;


More information about the svn-src-head mailing list