diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-06-21 21:42:18 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-06-21 21:42:18 +0000 |
commit | 022bd96880fa795784acd7451ccad2c96298b4f5 (patch) | |
tree | 32093b301a9a814fd31bacbe615019283e4fc678 | |
parent | ddd57534fbff52f10d79c7e6482a73936391f771 (diff) |
Buffer cache pages are wired but not counted as such. Therefore we have to
set the wire count on the pages to 0 before we call uvm_pagefree() on them,
just like we do in buf_free_pages(). Otherwise the wired pages counter goes
negative. While there, also sprinkle some KASSERTs in there that
buf_free_pages() has as well.
ok beck@
-rw-r--r-- | sys/uvm/uvm_page.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index b904577a544..2e75a67366b 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.c,v 1.126 2013/06/11 19:01:20 beck Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.127 2013/06/21 21:42:17 kettenis Exp $ */ /* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */ /* @@ -916,7 +916,6 @@ uvm_pagerealloc_multi(struct uvm_object *obj, voff_t off, vsize_t size, int i,r; voff_t offset; - TAILQ_INIT(&plist); if (size == 0) panic("size 0 uvm_pagerealloc"); @@ -928,11 +927,14 @@ uvm_pagerealloc_multi(struct uvm_object *obj, voff_t off, vsize_t size, while((pg = TAILQ_FIRST(&plist)) != NULL) { offset = off + ptoa(i++); tpg = uvm_pagelookup(obj, offset); + KASSERT(tpg != NULL); pg->wire_count = 1; atomic_setbits_int(&pg->pg_flags, PG_CLEAN | PG_FAKE); KASSERT((pg->pg_flags & PG_DEV) == 0); TAILQ_REMOVE(&plist, pg, pageq); uvm_pagecopy(tpg, pg); + KASSERT(tpg->wire_count == 1); + tpg->wire_count = 0; uvm_pagefree(tpg); uvm_pagealloc_pg(pg, obj, offset, NULL); } |