svn commit: r213901 - in stable/8/sys: amd64/amd64 amd64/include i386/i386 i386/include

Konstantin Belousov kib at FreeBSD.org
Fri Oct 15 17:56:52 UTC 2010


Author: kib
Date: Fri Oct 15 17:56:51 2010
New Revision: 213901
URL: http://svn.freebsd.org/changeset/base/213901

Log:
  MFC r209862:
  For both i386 and amd64 pmap,
  - change the type of pm_active to cpumask_t, which it is;
  - in pmap_remove_pages(), compare with PCPU(curpmap), instead of
    dereferencing the long chain of pointers [1].
  For amd64 pmap, remove the unneeded checks for validity of curpmap
  in pmap_activate(), since curpmap should be always valid after
  r209789.

Modified:
  stable/8/sys/amd64/amd64/pmap.c
  stable/8/sys/amd64/include/pmap.h
  stable/8/sys/i386/i386/pmap.c
  stable/8/sys/i386/include/pmap.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/8/sys/amd64/amd64/pmap.c	Fri Oct 15 15:46:58 2010	(r213900)
+++ stable/8/sys/amd64/amd64/pmap.c	Fri Oct 15 17:56:51 2010	(r213901)
@@ -3948,7 +3948,7 @@ pmap_remove_pages(pmap_t pmap)
 	uint64_t inuse, bitmask;
 	int allfree;
 
-	if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) {
+	if (pmap != PCPU_GET(curpmap)) {
 		printf("warning: pmap_remove_pages called with non-current pmap\n");
 		return;
 	}
@@ -4867,11 +4867,9 @@ pmap_activate(struct thread *td)
 	pmap = vmspace_pmap(td->td_proc->p_vmspace);
 	oldpmap = PCPU_GET(curpmap);
 #ifdef SMP
-if (oldpmap)	/* XXX FIXME */
 	atomic_clear_int(&oldpmap->pm_active, PCPU_GET(cpumask));
 	atomic_set_int(&pmap->pm_active, PCPU_GET(cpumask));
 #else
-if (oldpmap)	/* XXX FIXME */
 	oldpmap->pm_active &= ~PCPU_GET(cpumask);
 	pmap->pm_active |= PCPU_GET(cpumask);
 #endif

Modified: stable/8/sys/amd64/include/pmap.h
==============================================================================
--- stable/8/sys/amd64/include/pmap.h	Fri Oct 15 15:46:58 2010	(r213900)
+++ stable/8/sys/amd64/include/pmap.h	Fri Oct 15 17:56:51 2010	(r213901)
@@ -244,7 +244,7 @@ struct pmap {
 	struct mtx		pm_mtx;
 	pml4_entry_t		*pm_pml4;	/* KVA of level 4 page table */
 	TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */
-	u_int			pm_active;	/* active on cpus */
+	cpumask_t		pm_active;	/* active on cpus */
 	/* spare u_int here due to padding */
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	vm_page_t		pm_root;	/* spare page table pages */

Modified: stable/8/sys/i386/i386/pmap.c
==============================================================================
--- stable/8/sys/i386/i386/pmap.c	Fri Oct 15 15:46:58 2010	(r213900)
+++ stable/8/sys/i386/i386/pmap.c	Fri Oct 15 17:56:51 2010	(r213901)
@@ -4169,7 +4169,7 @@ pmap_remove_pages(pmap_t pmap)
 	uint32_t inuse, bitmask;
 	int allfree;
 
-	if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) {
+	if (pmap != PCPU_GET(curpmap)) {
 		printf("warning: pmap_remove_pages called with non-current pmap\n");
 		return;
 	}

Modified: stable/8/sys/i386/include/pmap.h
==============================================================================
--- stable/8/sys/i386/include/pmap.h	Fri Oct 15 15:46:58 2010	(r213900)
+++ stable/8/sys/i386/include/pmap.h	Fri Oct 15 17:56:51 2010	(r213901)
@@ -417,7 +417,7 @@ struct pmap {
 	struct mtx		pm_mtx;
 	pd_entry_t		*pm_pdir;	/* KVA of page directory */
 	TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */
-	u_int			pm_active;	/* active on cpus */
+	cpumask_t			pm_active;	/* active on cpus */
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	LIST_ENTRY(pmap) 	pm_list;	/* List of all pmaps */
 #ifdef PAE


More information about the svn-src-all mailing list