summaryrefslogtreecommitdiffstats
path: root/sys/i386
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/i386
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/i386')
-rw-r--r--sys/i386/i386/trap.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index 1e417bf..a3b1b0d 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -782,7 +782,6 @@ trap_pfault(frame, usermode, eva)
vm_offset_t eva;
{
vm_offset_t va;
- struct vmspace *vm;
vm_map_t map;
int rv = 0;
vm_prot_t ftype;
@@ -852,14 +851,7 @@ trap_pfault(frame, usermode, eva)
map = kernel_map;
} else {
- /*
- * This is a fault on non-kernel virtual memory. If either
- * p or p->p_vmspace is NULL, then the fault is fatal.
- */
- if (p == NULL || (vm = p->p_vmspace) == NULL)
- goto nogo;
-
- map = &vm->vm_map;
+ map = &p->p_vmspace->vm_map;
/*
* When accessing a user-space address, kernel must be
@@ -888,28 +880,8 @@ trap_pfault(frame, usermode, eva)
else
ftype = VM_PROT_READ;
- if (map != kernel_map) {
- /*
- * 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(map, va, ftype, VM_FAULT_NORMAL);
-
- PROC_LOCK(p);
- --p->p_lock;
- PROC_UNLOCK(p);
- } else {
- /*
- * Don't have to worry about process locking or stacks in the
- * kernel.
- */
- rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
- }
+ /* Fault in the page. */
+ rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
if (rv == KERN_SUCCESS) {
#ifdef HWPMC_HOOKS
if (ftype == VM_PROT_READ || ftype == VM_PROT_WRITE) {
OpenPOWER on IntegriCloud