diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-01-02 22:23:26 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-01-02 22:23:26 +0000 |
commit | 899f4edaa1b51e8179355617f9330dda84629077 (patch) | |
tree | f0b00a7faa0464aa4090cb830053879f0e474a0f /sys/uvm/uvm_anon.c | |
parent | 0e27c9b9c4315a03de0692896112b5a700e52439 (diff) |
Back out a few more uvm changes, especially wrt swap usage.
This unbreaks m68k m88k sparc and perhaps others, which eventually froze
when hitting swap.
Tested by various people on various platforms.
ok art@
Diffstat (limited to 'sys/uvm/uvm_anon.c')
-rw-r--r-- | sys/uvm/uvm_anon.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/sys/uvm/uvm_anon.c b/sys/uvm/uvm_anon.c index 9cf22f1f21f..658e7d7e9c1 100644 --- a/sys/uvm/uvm_anon.c +++ b/sys/uvm/uvm_anon.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_anon.c,v 1.19 2001/12/19 08:58:07 art Exp $ */ -/* $NetBSD: uvm_anon.c,v 1.15 2001/02/18 21:19:08 chs Exp $ */ +/* $OpenBSD: uvm_anon.c,v 1.20 2002/01/02 22:23:25 miod Exp $ */ +/* $NetBSD: uvm_anon.c,v 1.10 2000/11/25 06:27:59 chs Exp $ */ /* * @@ -103,13 +103,15 @@ uvm_anon_add(count) if (needed <= 0) { return 0; } + anon = (void *)uvm_km_alloc(kernel_map, sizeof(*anon) * needed); + + /* XXX Should wait for VM to free up. */ if (anon == NULL) { - simple_lock(&uvm.afreelock); - uvmexp.nanonneeded -= count; - simple_unlock(&uvm.afreelock); - return ENOMEM; + printf("uvm_anon_add: can not allocate %d anons\n", needed); + panic("uvm_anon_add"); } + MALLOC(anonblock, void *, sizeof(*anonblock), M_UVMAMAP, M_WAITOK); anonblock->count = needed; @@ -149,8 +151,6 @@ uvm_anon_remove(count) /* * allocate an anon - * - * => new anon is returned locked! */ struct vm_anon * uvm_analloc() @@ -165,8 +165,6 @@ uvm_analloc() a->an_ref = 1; a->an_swslot = 0; a->u.an_page = NULL; /* so we can free quickly */ - LOCK_ASSERT(simple_lock_held(&a->an_lock) == 0); - simple_lock(&a->an_lock); } simple_unlock(&uvm.afreelock); return(a); @@ -188,9 +186,6 @@ uvm_anfree(anon) UVMHIST_FUNC("uvm_anfree"); UVMHIST_CALLED(maphist); UVMHIST_LOG(maphist,"(anon=0x%x)", anon, 0,0,0); - KASSERT(anon->an_ref == 0); - LOCK_ASSERT(simple_lock_held(&anon->an_lock) == 0); - /* * get page */ @@ -321,8 +316,6 @@ uvm_anon_lockloanpg(anon) struct vm_page *pg; boolean_t locked = FALSE; - LOCK_ASSERT(simple_lock_held(&anon->an_lock)); - /* * loop while we have a resident page that has a non-zero loan count. * if we successfully get our lock, we will "break" the loop. @@ -477,10 +470,7 @@ anon_pagein(anon) int rv; /* locked: anon */ - LOCK_ASSERT(simple_lock_held(&anon->an_lock)); - rv = uvmfault_anonget(NULL, NULL, anon); - /* * if rv == VM_PAGER_OK, anon is still locked, else anon * is unlocked @@ -500,6 +490,13 @@ anon_pagein(anon) */ return FALSE; + + default: +#ifdef DIAGNOSTIC + panic("anon_pagein: uvmfault_anonget -> %d", rv); +#else + return FALSE; +#endif } /* |