diff options
author | Takuya ASADA <syuu@cvs.openbsd.org> | 2010-02-02 02:49:58 +0000 |
---|---|---|
committer | Takuya ASADA <syuu@cvs.openbsd.org> | 2010-02-02 02:49:58 +0000 |
commit | 16d2d319d68601a12f6c54756d8cb801a6423b20 (patch) | |
tree | 18de9de05f107657e1f6427825feeab2d1452e13 | |
parent | b850eb95035454bcbef37be7a5bfa20e6b2e453e (diff) |
Skip calling smp_rendezvous if it's not necessary.
ok miod@
-rw-r--r-- | sys/arch/mips64/include/pmap.h | 6 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/pmap.c | 55 |
2 files changed, 36 insertions, 25 deletions
diff --git a/sys/arch/mips64/include/pmap.h b/sys/arch/mips64/include/pmap.h index 93cf0a690a9..f036829d3b3 100644 --- a/sys/arch/mips64/include/pmap.h +++ b/sys/arch/mips64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.19 2010/01/05 06:44:58 syuu Exp $ */ +/* $OpenBSD: pmap.h,v 1.20 2010/02/02 02:49:57 syuu Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -149,7 +149,11 @@ void pmap_page_cache(vm_page_t, int); #define pmap_remove_holes(map) do { /* nothing */ } while (0) void pmap_update_user_page(pmap_t, vaddr_t, pt_entry_t); +#ifdef MULTIPROCESSOR void pmap_update_kernel_page(vaddr_t, pt_entry_t); +#else +#define pmap_update_kernel_page(va, entry) tlb_update(va, entry) +#endif #endif /* _KERNEL */ #endif /* !_MIPS_PMAP_H_ */ diff --git a/sys/arch/mips64/mips64/pmap.c b/sys/arch/mips64/mips64/pmap.c index bf54b232223..84fbcbfb325 100644 --- a/sys/arch/mips64/mips64/pmap.c +++ b/sys/arch/mips64/mips64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.48 2010/01/09 23:34:29 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.49 2010/02/02 02:49:57 syuu Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -70,13 +70,15 @@ struct pool_allocator pmap_pg_allocator = { pmap_pg_alloc, pmap_pg_free }; -static void pmap_invalidate_kernel_page(vaddr_t); static void pmap_invalidate_user_page(pmap_t, vaddr_t); #ifdef MULTIPROCESSOR +static void pmap_invalidate_kernel_page(vaddr_t); static void pmap_invalidate_kernel_page_action(void *); static void pmap_invalidate_user_page_action(void *); static void pmap_update_kernel_page_action(void *); static void pmap_update_user_page_action(void *); +#else +#define pmap_invalidate_kernel_page(va) tlb_flush_addr(va) #endif #ifdef PMAPDEBUG @@ -183,7 +185,7 @@ pmap_invalidate_kernel_page_action(void *arg) static void pmap_invalidate_user_page(pmap_t pmap, vaddr_t va) { - struct pmap_invalidate_page_arg arg; + unsigned int cpuid = cpu_number(); unsigned int cpumask = 0; struct cpu_info *ci; CPU_INFO_ITERATOR cii; @@ -202,10 +204,19 @@ pmap_invalidate_user_page(pmap_t pmap, vaddr_t va) cpumask |= m; } - arg.pmap = pmap; - arg.va = va; + if (cpumask == 1 << cpuid) { + u_long asid; + + asid = pmap->pm_asid[cpuid].pma_asid << VMTLB_PID_SHIFT; + tlb_flush_addr(va | asid); + } else if (cpumask) { + struct pmap_invalidate_page_arg arg; + arg.pmap = pmap; + arg.va = va; - smp_rendezvous_cpus(cpumask, pmap_invalidate_user_page_action, &arg); + smp_rendezvous_cpus(cpumask, pmap_invalidate_user_page_action, + &arg); + } } static void @@ -256,7 +267,7 @@ pmap_update_kernel_page_action(void *arg) void pmap_update_user_page(pmap_t pmap, vaddr_t va, pt_entry_t entry) { - struct pmap_update_page_arg arg; + unsigned int cpuid = cpu_number(); unsigned long cpumask = 0; struct cpu_info *ci; CPU_INFO_ITERATOR cii; @@ -275,11 +286,19 @@ pmap_update_user_page(pmap_t pmap, vaddr_t va, pt_entry_t entry) cpumask |= m; } - arg.pmap = pmap; - arg.va = va; - arg.entry = entry; - smp_rendezvous_cpus(cpumask, - pmap_update_user_page_action, &arg); + if (cpumask == 1 << cpuid) { + u_long asid; + + asid = pmap->pm_asid[cpuid].pma_asid << VMTLB_PID_SHIFT; + tlb_update(va | asid, entry); + } else if (cpumask) { + struct pmap_update_page_arg arg; + arg.pmap = pmap; + arg.va = va; + arg.entry = entry; + smp_rendezvous_cpus(cpumask, + pmap_update_user_page_action, &arg); + } } static void @@ -296,12 +315,6 @@ pmap_update_user_page_action(void *arg) } #else static void -pmap_invalidate_kernel_page(vaddr_t va) -{ - tlb_flush_addr(va); -} - -static void pmap_invalidate_user_page(pmap_t pmap, vaddr_t va) { u_long cpuid = cpu_number(); @@ -313,12 +326,6 @@ pmap_invalidate_user_page(pmap_t pmap, vaddr_t va) } void -pmap_update_kernel_page(vaddr_t va, pt_entry_t entry) -{ - tlb_update(va, entry); -} - -void pmap_update_user_page(pmap_t pmap, vaddr_t va, pt_entry_t entry) { u_long cpuid = cpu_number(); |