summaryrefslogtreecommitdiffstats
path: root/sys/uvm/uvm_km.c
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2009-07-22 21:05:37 +0000
committeroga <oga@openbsd.org>2009-07-22 21:05:37 +0000
commit0b0fe1a1323dc9bca0b7781b0239d273584d7ada (patch)
tree0086a622b3e4d0f09a8ff48b73ed7eb0d4e24562 /sys/uvm/uvm_km.c
parenttty_write is relatively short and the only function left in tty-write.c so move (diff)
downloadwireguard-openbsd-0b0fe1a1323dc9bca0b7781b0239d273584d7ada.tar.xz
wireguard-openbsd-0b0fe1a1323dc9bca0b7781b0239d273584d7ada.zip
Put the PG_RELEASED changes diff back in.
This has has been tested very very thoroughly on all archs we have excepting 88k and 68k. Please see cvs log for the individual commit messages. ok beck@, thib@
Diffstat (limited to 'sys/uvm/uvm_km.c')
-rw-r--r--sys/uvm/uvm_km.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c
index e6843631968..f30878ad873 100644
--- a/sys/uvm/uvm_km.c
+++ b/sys/uvm/uvm_km.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_km.c,v 1.73 2009/06/17 00:13:59 oga Exp $ */
+/* $OpenBSD: uvm_km.c,v 1.74 2009/07/22 21:05:37 oga Exp $ */
/* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */
/*
@@ -276,8 +276,12 @@ uvm_km_pgremove(struct uvm_object *uobj, vaddr_t start, vaddr_t end)
pp->pg_flags & PG_BUSY, 0, 0);
if (pp->pg_flags & PG_BUSY) {
- /* owner must check for this when done */
- atomic_setbits_int(&pp->pg_flags, PG_RELEASED);
+ atomic_setbits_int(&pp->pg_flags, PG_WANTED);
+ UVM_UNLOCK_AND_WAIT(pp, &uobj->vmobjlock, 0,
+ "km_pgrm", 0);
+ simple_lock(&uobj->vmobjlock);
+ curoff -= PAGE_SIZE; /* loop back to us */
+ continue;
} else {
/* free the swap slot... */
uao_dropswap(uobj, curoff >> PAGE_SHIFT);
@@ -511,21 +515,6 @@ uvm_km_alloc1(struct vm_map *map, vsize_t size, vsize_t align, boolean_t zeroit)
loopva = kva;
while (size) {
simple_lock(&uvm.kernel_object->vmobjlock);
- pg = uvm_pagelookup(uvm.kernel_object, offset);
-
- /*
- * if we found a page in an unallocated region, it must be
- * released
- */
- if (pg) {
- if ((pg->pg_flags & PG_RELEASED) == 0)
- panic("uvm_km_alloc1: non-released page");
- atomic_setbits_int(&pg->pg_flags, PG_WANTED);
- UVM_UNLOCK_AND_WAIT(pg, &uvm.kernel_object->vmobjlock,
- FALSE, "km_alloc", 0);
- continue; /* retry */
- }
-
/* allocate ram */
pg = uvm_pagealloc(uvm.kernel_object, offset, NULL, 0);
if (pg) {