Date: Fri, 9 Jul 2010 20:05:56 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r209862 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include Message-ID: <201007092005.o69K5uQ5035237@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Jul 9 20:05:56 2010 New Revision: 209862 URL: http://svn.freebsd.org/changeset/base/209862 Log: 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. Submitted by: alc [1] Reviewed by: alc MFC after: 3 weeks Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/i386/i386/pmap.c head/sys/i386/include/pmap.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Jul 9 19:38:30 2010 (r209861) +++ head/sys/amd64/amd64/pmap.c Fri Jul 9 20:05:56 2010 (r209862) @@ -4018,7 +4018,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; } @@ -4998,11 +4998,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: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Fri Jul 9 19:38:30 2010 (r209861) +++ head/sys/amd64/include/pmap.h Fri Jul 9 20:05:56 2010 (r209862) @@ -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 */ uint32_t pm_gen_count; /* generation count (pmap lock dropped) */ u_int pm_retries; /* spare u_int here due to padding */ Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Fri Jul 9 19:38:30 2010 (r209861) +++ head/sys/i386/i386/pmap.c Fri Jul 9 20:05:56 2010 (r209862) @@ -4180,7 +4180,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: head/sys/i386/include/pmap.h ============================================================================== --- head/sys/i386/include/pmap.h Fri Jul 9 19:38:30 2010 (r209861) +++ head/sys/i386/include/pmap.h Fri Jul 9 20:05:56 2010 (r209862) @@ -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 */ uint32_t pm_gen_count; /* generation count (pmap lock dropped) */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007092005.o69K5uQ5035237>