As astopgap minimize the sched_lock coverage in pmap_activate() in order

to reduce lock contention.
This commit is contained in:
Marius Strobl 2011-06-20 21:36:53 +00:00
parent 207f858338
commit 6308e06cf1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223347

View File

@ -2217,11 +2217,10 @@ pmap_activate(struct thread *td)
struct pmap *pm;
int context;
critical_enter();
vm = td->td_proc->p_vmspace;
pm = vmspace_pmap(vm);
mtx_lock_spin(&sched_lock);
context = PCPU_GET(tlb_ctx);
if (context == PCPU_GET(tlb_ctx_max)) {
tlb_flush_user();
@ -2229,17 +2228,18 @@ pmap_activate(struct thread *td)
}
PCPU_SET(tlb_ctx, context + 1);
mtx_lock_spin(&sched_lock);
pm->pm_context[curcpu] = context;
CPU_SET(PCPU_GET(cpuid), &pm->pm_active);
PCPU_SET(pmap, pm);
mtx_unlock_spin(&sched_lock);
stxa(AA_DMMU_TSB, ASI_DMMU, pm->pm_tsb);
stxa(AA_IMMU_TSB, ASI_IMMU, pm->pm_tsb);
stxa(AA_DMMU_PCXR, ASI_DMMU, (ldxa(AA_DMMU_PCXR, ASI_DMMU) &
TLB_CXR_PGSZ_MASK) | context);
flush(KERNBASE);
mtx_unlock_spin(&sched_lock);
critical_exit();
}
void