diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2006-03-06 19:11:04 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2006-03-06 19:11:04 +0000 |
commit | bf9d0ca3e7b475f208176c9233b98afd7e73a531 (patch) | |
tree | 1919bf7663986a8bb9258ee70744c1a752fe729e | |
parent | 30a5db1b60cfa5bc65715d448757ece6a2067200 (diff) |
deal w/ uvm_km_alloc() returning null; tedu@ ok
-rw-r--r-- | sys/uvm/uvm_km.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index 7a6c67ae568..53ba23aa740 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.48 2005/10/06 03:59:50 brad Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.49 2006/03/06 19:11:03 mickey Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -998,23 +998,27 @@ uvm_km_thread(void *arg) struct km_page *head, *tail, *page; int i, s, want; - for (;;) { - if (uvm_km_pages_free >= uvm_km_pages_lowat) + for (i = want = 16; ; ) { + if (i < want || uvm_km_pages_free >= uvm_km_pages_lowat) tsleep(&uvm_km_pages_head, PVM, "kmalloc", 0); - want = 16; for (i = 0; i < want; i++) { page = (void *)uvm_km_alloc(kernel_map, PAGE_SIZE); if (i == 0) head = tail = page; + if (page == NULL) + break; page->next = head; head = page; } - s = splvm(); - tail->next = uvm_km_pages_head; - uvm_km_pages_head = head; - uvm_km_pages_free += i; - splx(s); - wakeup(&uvm_km_pages_free); + if (head != NULL) { + s = splvm(); + tail->next = uvm_km_pages_head; + uvm_km_pages_head = head; + uvm_km_pages_free += i; + splx(s); + } + if (uvm_km_pages_free) + wakeup(&uvm_km_pages_free); } } |