summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-12-01 12:03:56 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-12-01 12:03:56 +0000
commit2bdd715ad27530e888318d26e88f21f80734bd7e (patch)
tree49c29bd1349684b13358417dfbac2dcc667b0d79 /sys/arch
parent7458c9df8a70a85b4e4faf3e09b2757a80c4c448 (diff)
Pass M_NOWAIT when allocating a temporary page in vm_writepage() to be
coherent with the rest of the allocations. While here report the correct errno if an allocation fails. ok mlarkin@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/vmm.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 2fd5d96dadd..9ef52a67dd0 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.14 2015/12/01 12:01:38 mpi Exp $ */
+/* $OpenBSD: vmm.c,v 1.15 2015/12/01 12:03:55 mpi Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -472,9 +472,8 @@ vm_writepage(struct vm_writepage_params *vwp)
}
/* Allocate temporary region to copyin into */
- pagedata = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO);
-
- if (!pagedata) {
+ pagedata = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT|M_ZERO);
+ if (pagedata == NULL) {
rw_exit_read(&vmm_softc->vm_lock);
return (ENOMEM);
}
@@ -505,11 +504,11 @@ vm_writepage(struct vm_writepage_params *vwp)
/* Allocate kva for guest page */
kva = km_alloc(PAGE_SIZE, &kv_any, &kp_none, &kd_nowait);
- if (!kva) {
+ if (kva == NULL) {
DPRINTF("vm_writepage: can't alloc kva\n");
free(pagedata, M_DEVBUF, PAGE_SIZE);
rw_exit_read(&vmm_softc->vm_lock);
- return (EFAULT);
+ return (ENOMEM);
}
/* Enter mapping and copy data */