pmap_deactivate(): only update the pmap's cpuset if need to.

This commit is contained in:
pk 2003-01-17 14:15:17 +00:00
parent f843b3302c
commit d352e8ce9c

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.229 2003/01/14 13:56:07 pk Exp $ */ /* $NetBSD: pmap.c,v 1.230 2003/01/17 14:15:17 pk Exp $ */
/* /*
* Copyright (c) 1996 * Copyright (c) 1996
@ -7147,7 +7147,7 @@ void
pmap_activate(p) pmap_activate(p)
struct proc *p; struct proc *p;
{ {
pmap_t pmap = p->p_vmspace->vm_map.pmap; pmap_t pm = p->p_vmspace->vm_map.pmap;
int s; int s;
/* /*
@ -7160,18 +7160,18 @@ pmap_activate(p)
s = splvm(); s = splvm();
if (p == curproc) { if (p == curproc) {
write_user_windows(); write_user_windows();
if (pmap->pm_ctx == NULL) { if (pm->pm_ctx == NULL) {
ctx_alloc(pmap); /* performs setcontext() */ ctx_alloc(pm); /* performs setcontext() */
} else { } else {
/* Do any cache flush needed on context switch */ /* Do any cache flush needed on context switch */
(*cpuinfo.pure_vcache_flush)(); (*cpuinfo.pure_vcache_flush)();
setcontext(pmap->pm_ctxnum); setcontext(pm->pm_ctxnum);
} }
}
#if defined(MULTIPROCESSOR) #if defined(MULTIPROCESSOR)
if (pmap != pmap_kernel()) if (pm != pmap_kernel())
PMAP_SET_CPUSET(pmap, &cpuinfo); PMAP_SET_CPUSET(pm, &cpuinfo);
#endif #endif
}
splx(s); splx(s);
} }
@ -7183,15 +7183,15 @@ pmap_deactivate(p)
struct proc *p; struct proc *p;
{ {
#if defined(MULTIPROCESSOR) #if defined(MULTIPROCESSOR)
pmap_t pmap; pmap_t pm;
if (p && p->p_vmspace && if (p && p->p_vmspace &&
(pmap = p->p_vmspace->vm_map.pmap) != pmap_kernel()) { (pm = p->p_vmspace->vm_map.pmap) != pmap_kernel()) {
if (pmap->pm_ctx) if (pm->pm_ctx && CPU_HAS_SRMMU)
sp_tlb_flush(0, pmap->pm_ctxnum, ASI_SRMMUFP_L0); sp_tlb_flush(0, pm->pm_ctxnum, ASI_SRMMUFP_L0);
/* we no longer need broadcast tlb flushes for this pmap. */ /* we no longer need broadcast tlb flushes for this pmap. */
PMAP_CLR_CPUSET(pmap, &cpuinfo); PMAP_CLR_CPUSET(pm, &cpuinfo);
} }
#endif #endif
} }