summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-09-10 17:46:48 +0000
committerkib <kib@FreeBSD.org>2015-09-10 17:46:48 +0000
commit98df6be0286a4c7c9e09982b5ebaf40624012a51 (patch)
treed2b60efe1b90d00962597043684dc1d7b73de7d3 /sys/sparc64
parent7ee575bccae31cf9cf140b6bd20f80360024ade4 (diff)
downloadFreeBSD-src-98df6be0286a4c7c9e09982b5ebaf40624012a51.zip
FreeBSD-src-98df6be0286a4c7c9e09982b5ebaf40624012a51.tar.gz
Do not hold the process around the vm_fault() call from the trap()s.
The only operation which is prevented by the hold is the kernel stack swapout for the faulted thread, which should be fine to allow. Remove useless checks for NULL curproc or curproc->p_vmspace from the trap_pfault() wrappers on x86 and powerpc. Reviewed by: alc (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/sparc64/trap.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c
index e9917e5..96e72ed 100644
--- a/sys/sparc64/sparc64/trap.c
+++ b/sys/sparc64/sparc64/trap.c
@@ -441,7 +441,7 @@ trap_cecc(void)
static int
trap_pfault(struct thread *td, struct trapframe *tf)
{
- struct vmspace *vm;
+ vm_map_t map;
struct proc *p;
vm_offset_t va;
vm_prot_t prot;
@@ -484,28 +484,8 @@ trap_pfault(struct thread *td, struct trapframe *tf)
return (0);
}
- /*
- * This is a fault on non-kernel virtual memory.
- */
- vm = p->p_vmspace;
-
- /*
- * Keep swapout from messing with us during this
- * critical time.
- */
- PROC_LOCK(p);
- ++p->p_lock;
- PROC_UNLOCK(p);
-
- /* Fault in the user page. */
- rv = vm_fault(&vm->vm_map, va, prot, VM_FAULT_NORMAL);
-
- /*
- * Now the process can be swapped again.
- */
- PROC_LOCK(p);
- --p->p_lock;
- PROC_UNLOCK(p);
+ /* This is a fault on non-kernel virtual memory. */
+ map = &p->p_vmspace->vm_map;
} else {
/*
* This is a fault on kernel virtual memory. Attempts to
@@ -527,14 +507,12 @@ trap_pfault(struct thread *td, struct trapframe *tf)
}
vm_map_unlock_read(kernel_map);
}
-
- /*
- * We don't have to worry about process locking or stacks in
- * the kernel.
- */
- rv = vm_fault(kernel_map, va, prot, VM_FAULT_NORMAL);
+ map = kernel_map;
}
+ /* Fault in the page. */
+ rv = vm_fault(map, va, prot, VM_FAULT_NORMAL);
+
CTR3(KTR_TRAP, "trap_pfault: return td=%p va=%#lx rv=%d",
td, va, rv);
if (rv == KERN_SUCCESS)
OpenPOWER on IntegriCloud