Module Name: src Committed By: matt Date: Wed Feb 29 18:03:40 UTC 2012
Modified Files: src/sys/miscfs/genfs [matt-nb5-mips64]: genfs_io.c src/sys/uvm [matt-nb5-mips64]: files.uvm uvm.h uvm_amap.c uvm_aobj.c uvm_bio.c uvm_fault.c uvm_km.c uvm_loan.c uvm_map.c uvm_page.c uvm_page.h uvm_pdaemon.c uvm_pglist.c uvm_vnode.c Log Message: Improve UVM_PAGE_TRKOWN. Add more asserts to uvm_page. To generate a diff of this commit: cvs rdiff -u -r1.13.4.2.4.4 -r1.13.4.2.4.5 src/sys/miscfs/genfs/genfs_io.c cvs rdiff -u -r1.11 -r1.11.12.1 src/sys/uvm/files.uvm cvs rdiff -u -r1.55.16.3 -r1.55.16.4 src/sys/uvm/uvm.h cvs rdiff -u -r1.84.20.1.4.1 -r1.84.20.1.4.2 src/sys/uvm/uvm_amap.c cvs rdiff -u -r1.104.10.2 -r1.104.10.3 src/sys/uvm/uvm_aobj.c cvs rdiff -u -r1.65 -r1.65.14.1 src/sys/uvm/uvm_bio.c cvs rdiff -u -r1.125.6.1.4.3 -r1.125.6.1.4.4 src/sys/uvm/uvm_fault.c cvs rdiff -u -r1.101.4.2.4.8 -r1.101.4.2.4.9 src/sys/uvm/uvm_km.c cvs rdiff -u -r1.72 -r1.72.10.1 src/sys/uvm/uvm_loan.c cvs rdiff -u -r1.263.4.3.4.7 -r1.263.4.3.4.8 src/sys/uvm/uvm_map.c cvs rdiff -u -r1.140.6.3.4.9 -r1.140.6.3.4.10 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.55.14.8 -r1.55.14.9 src/sys/uvm/uvm_page.h cvs rdiff -u -r1.93.4.2.4.7 -r1.93.4.2.4.8 src/sys/uvm/uvm_pdaemon.c cvs rdiff -u -r1.42.16.12 -r1.42.16.13 src/sys/uvm/uvm_pglist.c cvs rdiff -u -r1.90.28.3 -r1.90.28.4 src/sys/uvm/uvm_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/miscfs/genfs/genfs_io.c diff -u src/sys/miscfs/genfs/genfs_io.c:1.13.4.2.4.4 src/sys/miscfs/genfs/genfs_io.c:1.13.4.2.4.5 --- src/sys/miscfs/genfs/genfs_io.c:1.13.4.2.4.4 Thu Feb 9 03:08:31 2012 +++ src/sys/miscfs/genfs/genfs_io.c Wed Feb 29 18:03:37 2012 @@ -693,7 +693,7 @@ out: } uvm_pageenqueue(pg); pg->flags &= ~(PG_WANTED|PG_BUSY|PG_FAKE); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); } } mutex_exit(&uvm_pageqlock); @@ -1037,7 +1037,7 @@ retry: wasclean = false; memset(pgs, 0, sizeof(pgs)); pg->flags |= PG_BUSY; - UVM_PAGE_OWN(pg, "genfs_putpages"); + UVM_PAGE_OWN(pg, "genfs_putpages", NULL); /* * first look backward. @@ -1115,6 +1115,7 @@ retry: */ nextpg = TAILQ_NEXT(tpg, listq.queue); + uvm_pagedequeue(tpg); uvm_pagefree(tpg); if (pagedaemon) { uvm_page_to_pggroup(tpg)->pgrp_pdfreed++; Index: src/sys/uvm/files.uvm diff -u src/sys/uvm/files.uvm:1.11 src/sys/uvm/files.uvm:1.11.12.1 --- src/sys/uvm/files.uvm:1.11 Wed Jun 4 17:47:40 2008 +++ src/sys/uvm/files.uvm Wed Feb 29 18:03:38 2012 @@ -1,10 +1,10 @@ -# $NetBSD: files.uvm,v 1.11 2008/06/04 17:47:40 ad Exp $ +# $NetBSD: files.uvm,v 1.11.12.1 2012/02/29 18:03:38 matt Exp $ # # UVM options # defflag opt_uvmhist.h UVMHIST UVMHIST_PRINT -defflag opt_uvm.h USE_TOPDOWN_VM UVMMAP_COUNTERS +defflag opt_uvm.h USE_TOPDOWN_VM UVMMAP_COUNTERS UVM_PAGE_TRKOWN defflag opt_vmswap.h VMSWAP defflag opt_readahead.h READAHEAD_STATS defflag opt_ubc.h UBC_STATS Index: src/sys/uvm/uvm.h diff -u src/sys/uvm/uvm.h:1.55.16.3 src/sys/uvm/uvm.h:1.55.16.4 --- src/sys/uvm/uvm.h:1.55.16.3 Thu Feb 9 03:04:59 2012 +++ src/sys/uvm/uvm.h Wed Feb 29 18:03:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm.h,v 1.55.16.3 2012/02/09 03:04:59 matt Exp $ */ +/* $NetBSD: uvm.h,v 1.55.16.4 2012/02/29 18:03:38 matt Exp $ */ /* * @@ -204,9 +204,9 @@ void uvm_kick_pdaemon(void); */ #if defined(UVM_PAGE_TRKOWN) -#define UVM_PAGE_OWN(PG, TAG) uvm_page_own(PG, TAG) +#define UVM_PAGE_OWN(PG, TAG, ADDR) uvm_page_own(PG, TAG, ADDR) #else -#define UVM_PAGE_OWN(PG, TAG) /* nothing */ +#define UVM_PAGE_OWN(PG, TAG, ADDR) /* nothing */ #endif /* UVM_PAGE_TRKOWN */ #include <uvm/uvm_fault_i.h> Index: src/sys/uvm/uvm_amap.c diff -u src/sys/uvm/uvm_amap.c:1.84.20.1.4.1 src/sys/uvm/uvm_amap.c:1.84.20.1.4.2 --- src/sys/uvm/uvm_amap.c:1.84.20.1.4.1 Thu Feb 9 03:04:59 2012 +++ src/sys/uvm/uvm_amap.c Wed Feb 29 18:03:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_amap.c,v 1.84.20.1.4.1 2012/02/09 03:04:59 matt Exp $ */ +/* $NetBSD: uvm_amap.c,v 1.84.20.1.4.2 2012/02/29 18:03:38 matt Exp $ */ /* * @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.84.20.1.4.1 2012/02/09 03:04:59 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.84.20.1.4.2 2012/02/29 18:03:38 matt Exp $"); #include "opt_uvmhist.h" @@ -1039,7 +1039,7 @@ ReStart: uvm_pageactivate(npg); mutex_exit(&uvm_pageqlock); npg->flags &= ~(PG_BUSY|PG_FAKE); - UVM_PAGE_OWN(npg, NULL); + UVM_PAGE_OWN(npg, NULL, NULL); mutex_exit(&nanon->an_lock); mutex_exit(&anon->an_lock); } Index: src/sys/uvm/uvm_aobj.c diff -u src/sys/uvm/uvm_aobj.c:1.104.10.2 src/sys/uvm/uvm_aobj.c:1.104.10.3 --- src/sys/uvm/uvm_aobj.c:1.104.10.2 Fri Jun 3 07:59:57 2011 +++ src/sys/uvm/uvm_aobj.c Wed Feb 29 18:03:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_aobj.c,v 1.104.10.2 2011/06/03 07:59:57 matt Exp $ */ +/* $NetBSD: uvm_aobj.c,v 1.104.10.3 2012/02/29 18:03:38 matt Exp $ */ /* * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and @@ -43,7 +43,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.104.10.2 2011/06/03 07:59:57 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.104.10.3 2012/02/29 18:03:38 matt Exp $"); #include "opt_uvmhist.h" @@ -1004,7 +1004,7 @@ uao_get(struct uvm_object *uobj, voff_t /* caller must un-busy this page */ ptmp->flags |= PG_BUSY; - UVM_PAGE_OWN(ptmp, "uao_get1"); + UVM_PAGE_OWN(ptmp, "uao_get1", NULL); gotpage: pps[lcv] = ptmp; gotpages++; @@ -1119,7 +1119,7 @@ gotpage: /* we own it, caller must un-busy */ ptmp->flags |= PG_BUSY; - UVM_PAGE_OWN(ptmp, "uao_get2"); + UVM_PAGE_OWN(ptmp, "uao_get2", NULL); pps[lcv] = ptmp; } @@ -1466,7 +1466,7 @@ uao_pagein_page(struct uvm_aobj *aobj, i wakeup(pg); } pg->flags &= ~(PG_WANTED|PG_BUSY|PG_CLEAN|PG_FAKE); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); return false; } Index: src/sys/uvm/uvm_bio.c diff -u src/sys/uvm/uvm_bio.c:1.65 src/sys/uvm/uvm_bio.c:1.65.14.1 --- src/sys/uvm/uvm_bio.c:1.65 Mon May 5 17:11:17 2008 +++ src/sys/uvm/uvm_bio.c Wed Feb 29 18:03:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_bio.c,v 1.65 2008/05/05 17:11:17 ad Exp $ */ +/* $NetBSD: uvm_bio.c,v 1.65.14.1 2012/02/29 18:03:38 matt Exp $ */ /* * Copyright (c) 1998 Chuck Silvers. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.65 2008/05/05 17:11:17 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.65.14.1 2012/02/29 18:03:38 matt Exp $"); #include "opt_uvmhist.h" #include "opt_ubc.h" @@ -389,7 +389,7 @@ again: uvm_pageactivate(pg); mutex_exit(&uvm_pageqlock); pg->flags &= ~(PG_BUSY|PG_WANTED); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); mutex_exit(&uobj->vmobjlock); if (error) { UVMHIST_LOG(ubchist, "pmap_enter fail %d", Index: src/sys/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.125.6.1.4.3 src/sys/uvm/uvm_fault.c:1.125.6.1.4.4 --- src/sys/uvm/uvm_fault.c:1.125.6.1.4.3 Fri Jun 3 07:59:57 2011 +++ src/sys/uvm/uvm_fault.c Wed Feb 29 18:03:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.125.6.1.4.3 2011/06/03 07:59:57 matt Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.125.6.1.4.4 2012/02/29 18:03:38 matt Exp $ */ /* * @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.125.6.1.4.3 2011/06/03 07:59:57 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.125.6.1.4.4 2012/02/29 18:03:38 matt Exp $"); #include "opt_uvmhist.h" @@ -493,7 +493,7 @@ released: uvm_pageactivate(pg); mutex_exit(&uvm_pageqlock); pg->flags &= ~(PG_WANTED|PG_BUSY|PG_FAKE); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); if (!locked) mutex_exit(&anon->an_lock); #else /* defined(VMSWAP) */ @@ -1138,7 +1138,7 @@ ReFault: KASSERT((curpg->flags & PG_RELEASED) == 0); curpg->flags &= ~(PG_BUSY); - UVM_PAGE_OWN(curpg, NULL); + UVM_PAGE_OWN(curpg, NULL, NULL); } pmap_update(ufi.orig_map->pmap); } @@ -1316,7 +1316,7 @@ ReFault: mutex_exit(&uvm_pageqlock); pg->flags &= ~(PG_BUSY|PG_FAKE); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); /* done! */ } /* ref == 1 */ @@ -1358,7 +1358,7 @@ ReFault: uvm_pageactivate(pg); mutex_exit(&uvm_pageqlock); pg->flags &= ~(PG_BUSY|PG_FAKE); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); /* deref: can not drop to zero here by defn! */ oanon->an_ref--; @@ -1577,7 +1577,7 @@ Case2: goto ReFault; } uobjpage->flags &= ~(PG_BUSY|PG_WANTED); - UVM_PAGE_OWN(uobjpage, NULL); + UVM_PAGE_OWN(uobjpage, NULL, NULL); mutex_exit(&uobj->vmobjlock); goto ReFault; } @@ -1656,7 +1656,7 @@ Case2: if (uobjpage->flags & PG_WANTED) wakeup(uobjpage); uobjpage->flags &= ~(PG_BUSY|PG_WANTED); - UVM_PAGE_OWN(uobjpage, NULL); + UVM_PAGE_OWN(uobjpage, NULL, NULL); uvmfault_unlockall(&ufi, amap, uobj, NULL); @@ -1722,7 +1722,7 @@ Case2: /* still have the obj lock */ wakeup(uobjpage); uobjpage->flags &= ~(PG_BUSY|PG_WANTED); - UVM_PAGE_OWN(uobjpage, NULL); + UVM_PAGE_OWN(uobjpage, NULL, NULL); mutex_exit(&uobj->vmobjlock); uobj = NULL; @@ -1788,7 +1788,7 @@ Case2: KASSERT((pg->flags & PG_RELEASED) == 0); pg->flags &= ~(PG_BUSY|PG_FAKE|PG_WANTED); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); uvmfault_unlockall(&ufi, amap, uobj, anon); if (!uvm_reclaimable()) { UVMHIST_LOG(maphist, @@ -1832,7 +1832,7 @@ Case2: KASSERT((pg->flags & PG_RELEASED) == 0); pg->flags &= ~(PG_BUSY|PG_FAKE|PG_WANTED); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); uvmfault_unlockall(&ufi, amap, uobj, anon); pmap_update(ufi.orig_map->pmap); UVMHIST_LOG(maphist, "<- done (SUCCESS!)",0,0,0,0); Index: src/sys/uvm/uvm_km.c diff -u src/sys/uvm/uvm_km.c:1.101.4.2.4.8 src/sys/uvm/uvm_km.c:1.101.4.2.4.9 --- src/sys/uvm/uvm_km.c:1.101.4.2.4.8 Tue Feb 14 01:12:42 2012 +++ src/sys/uvm/uvm_km.c Wed Feb 29 18:03:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_km.c,v 1.101.4.2.4.8 2012/02/14 01:12:42 matt Exp $ */ +/* $NetBSD: uvm_km.c,v 1.101.4.2.4.9 2012/02/29 18:03:38 matt Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -128,7 +128,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.101.4.2.4.8 2012/02/14 01:12:42 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.101.4.2.4.9 2012/02/29 18:03:38 matt Exp $"); #include "opt_uvmhist.h" @@ -632,7 +632,7 @@ uvm_km_alloc(struct vm_map *map, vsize_t uvm_km_pageclaim(pg); pg->flags &= ~PG_BUSY; /* new page */ - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); /* * map it in Index: src/sys/uvm/uvm_loan.c diff -u src/sys/uvm/uvm_loan.c:1.72 src/sys/uvm/uvm_loan.c:1.72.10.1 --- src/sys/uvm/uvm_loan.c:1.72 Tue Jun 17 02:29:10 2008 +++ src/sys/uvm/uvm_loan.c Wed Feb 29 18:03:39 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_loan.c,v 1.72 2008/06/17 02:29:10 yamt Exp $ */ +/* $NetBSD: uvm_loan.c,v 1.72.10.1 2012/02/29 18:03:39 matt Exp $ */ /* * @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.72 2008/06/17 02:29:10 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.72.10.1 2012/02/29 18:03:39 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -724,7 +724,7 @@ uvm_loanuobj(struct uvm_faultinfo *ufi, uvm_pageactivate(pg); mutex_exit(&uvm_pageqlock); pg->flags &= ~(PG_BUSY|PG_WANTED); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); mutex_exit(&uobj->vmobjlock); return (0); } @@ -765,7 +765,7 @@ uvm_loanuobj(struct uvm_faultinfo *ufi, wakeup(pg); } pg->flags &= ~(PG_WANTED|PG_BUSY); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); mutex_exit(&uobj->vmobjlock); **output = anon; (*output)++; @@ -803,7 +803,7 @@ uvm_loanuobj(struct uvm_faultinfo *ufi, wakeup(pg); } pg->flags &= ~(PG_WANTED|PG_BUSY); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); mutex_exit(&uobj->vmobjlock); mutex_exit(&anon->an_lock); **output = anon; @@ -819,7 +819,7 @@ fail: wakeup(pg); } pg->flags &= ~(PG_WANTED|PG_BUSY); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); uvmfault_unlockall(ufi, amap, uobj, NULL); return (-1); } @@ -874,7 +874,7 @@ again: mutex_enter(&uvm_pageqlock); uvm_pageactivate(pg); mutex_exit(&uvm_pageqlock); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); } if ((flags & UVM_LOAN_TOANON) == 0) { /* loaning to kernel-page */ @@ -1148,7 +1148,7 @@ uvm_loanbreak(struct vm_page *uobjpage) wakeup(uobjpage); /* uobj still locked */ uobjpage->flags &= ~(PG_WANTED|PG_BUSY); - UVM_PAGE_OWN(uobjpage, NULL); + UVM_PAGE_OWN(uobjpage, NULL, NULL); mutex_enter(&uvm_pageqlock); Index: src/sys/uvm/uvm_map.c diff -u src/sys/uvm/uvm_map.c:1.263.4.3.4.7 src/sys/uvm/uvm_map.c:1.263.4.3.4.8 --- src/sys/uvm/uvm_map.c:1.263.4.3.4.7 Thu Feb 9 03:04:59 2012 +++ src/sys/uvm/uvm_map.c Wed Feb 29 18:03:39 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.c,v 1.263.4.3.4.7 2012/02/09 03:04:59 matt Exp $ */ +/* $NetBSD: uvm_map.c,v 1.263.4.3.4.8 2012/02/29 18:03:39 matt Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -71,7 +71,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.263.4.3.4.7 2012/02/09 03:04:59 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.263.4.3.4.8 2012/02/29 18:03:39 matt Exp $"); #include "opt_ddb.h" #include "opt_uvmhist.h" @@ -2431,7 +2431,7 @@ uvm_unmap_remove(struct vm_map *map, vad for (va = entry->start; va < entry->end; va += PAGE_SIZE) { if (pmap_extract(vm_map_pmap(map), va, NULL)) { - panic("uvm_unmap_remove: has mapping"); + panic("uvm_unmap_remove: entry %p (%#"PRIxVADDR"...%#"PRIxVADDR") has mapping at %#"PRIxVADDR, entry, entry->start, entry->end, va); } } @@ -5069,10 +5069,10 @@ uvm_page_printit(struct vm_page *pg, boo pg->uobject, pg->uanon, (long long)pg->offset, pg->loan_count); #if defined(UVM_PAGE_TRKOWN) if (pg->flags & PG_BUSY) - (*pr)(" owning process = %d, tag=%s\n", - pg->owner, pg->owner_tag); + (*pr)(" owning process = %d, tag=%s, addr=%p\n", + pg->owner, pg->owner_tag, pg->owner_addr); else - (*pr)(" page not busy, no owner\n"); + (*pr)(" page not busy, no owner (addr=%p)\n", pg->owner_addr); #else (*pr)(" [page ownership tracking disabled]\n"); #endif Index: src/sys/uvm/uvm_page.c diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.9 src/sys/uvm/uvm_page.c:1.140.6.3.4.10 --- src/sys/uvm/uvm_page.c:1.140.6.3.4.9 Thu Feb 16 04:20:45 2012 +++ src/sys/uvm/uvm_page.c Wed Feb 29 18:03:39 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.140.6.3.4.9 2012/02/16 04:20:45 matt Exp $ */ +/* $NetBSD: uvm_page.c,v 1.140.6.3.4.10 2012/02/29 18:03:39 matt Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -71,7 +71,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.140.6.3.4.9 2012/02/16 04:20:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.140.6.3.4.10 2012/02/29 18:03:39 matt Exp $"); #include "opt_uvmhist.h" #include "opt_readahead.h" @@ -486,6 +486,19 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr } } } +#if defined(DIAGNOSTIC) + for (u_int color = 0; color < uvmexp.ncolors; color++) { + for (u_int free_list = 0; free_list < VM_NFREELIST; free_list++) { + for (u_int queue = 0; queue < PGFL_NQUEUES; queue++) { + struct vm_page *pg; + KASSERT(LIST_FIRST(&uvm.page_free[color].pgfl_queues[free_list][queue]) == LIST_FIRST(&uvm.cpus[0].page_free[color].pgfl_queues[free_list][queue])); + LIST_FOREACH(pg, &uvm.page_free[color].pgfl_queues[free_list][queue], pageq.list) { + KASSERT(LIST_NEXT(pg, pageq.list) == LIST_NEXT(pg, listq.list)); + } + } + } + } +#endif /* * pass up the values of virtual_space_start and @@ -988,7 +1001,7 @@ uvm_page_recolor(int newncolors) const u_int pgcolor = VM_PGCOLOR_BUCKET(pg); LIST_REMOVE(pg, pageq.list); /* global */ - LIST_REMOVE(pg, listq.list); /* cpu */ + LIST_REMOVE(pg, listq.list); /* per-cpu */ old_gpgfl->pgfl_pages[queue]--; VM_FREE_PAGE_TO_CPU(pg)->page_free[ @@ -1113,21 +1126,33 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu, do { pgfl = &ucpu->page_free[color]; gpgfl = &uvm.page_free[color]; + struct pgflist * const freeq = pgfl->pgfl_queues[free_list]; + struct pgflist * const gfreeq = gpgfl->pgfl_queues[free_list]; + +#ifndef MULTIPROCESSOR + KASSERT(pgfl->pgfl_pages[try1] == gpgfl->pgfl_pages[try1]); + KASSERT(pgfl->pgfl_pages[try2] == gpgfl->pgfl_pages[try2]); +#endif /* cpu, try1 */ - struct pgflist * const freeq = pgfl->pgfl_queues[free_list]; +#ifndef MULTIPROCESSOR + KASSERT(LIST_FIRST(&gfreeq[try1]) == LIST_FIRST(&freeq[try1])); + KASSERT(LIST_FIRST(&gfreeq[try2]) == LIST_FIRST(&freeq[try2])); +#endif + if ((pg = LIST_FIRST(&freeq[try1])) != NULL) { KASSERT(pg->pqflags & PQ_FREE); KASSERT(ucpu == VM_FREE_PAGE_TO_CPU(pg)); KASSERT(pgfl == &ucpu->page_free[color]); + KASSERT(pgfl->pgfl_pages[try1] > 0); ucpu->page_cpuhit++; goto gotit; } /* global, try1 */ - struct pgflist * const gfreeq = gpgfl->pgfl_queues[free_list]; if ((pg = LIST_FIRST(&gfreeq[try1])) != NULL) { KASSERT(pg->pqflags & PQ_FREE); + KASSERT(gpgfl->pgfl_pages[try1] > 0); ucpu = VM_FREE_PAGE_TO_CPU(pg); #ifndef MULTIPROCESSOR KASSERT(ucpu == uvm.cpus); @@ -1142,6 +1167,7 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu, KASSERT(pg->pqflags & PQ_FREE); KASSERT(ucpu == VM_FREE_PAGE_TO_CPU(pg)); KASSERT(pgfl == &ucpu->page_free[color]); + KASSERT(pgfl->pgfl_pages[try2] > 0); ucpu->page_cpuhit++; try1 = try2; goto gotit; @@ -1149,7 +1175,10 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu, /* global, try2 */ if ((pg = LIST_FIRST(&gfreeq[try2])) != NULL) { - KASSERT(pg->pqflags & PQ_FREE); + KASSERTMSG(pg->pqflags & PQ_FREE, + ("%s: pg %p in q %p not free!", + __func__, pg, &gfreeq[try2])); + KASSERT(gpgfl->pgfl_pages[try2] > 0); ucpu = VM_FREE_PAGE_TO_CPU(pg); #ifndef MULTIPROCESSOR KASSERT(ucpu == uvm.cpus); @@ -1167,10 +1196,36 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu, return (NULL); gotit: +#ifndef MULTIPROCESSOR + KASSERT(LIST_FIRST(&ucpu->page_free[color].pgfl_queues[free_list][try1]) == pg); + KASSERT(LIST_FIRST(&uvm.page_free[color].pgfl_queues[free_list][try1]) == pg); +#if defined(DEBUG) && DEBUG > 1 + { + struct vm_page *xpg = pg; + u_int i = 0; + do { + KASSERTMSG(LIST_NEXT(xpg, pageq.list) == LIST_NEXT(xpg, listq.list), + ("%s: color %d free_list %d pg %p (%u): next %p/%p", + __func__, color, free_list, xpg, i, + LIST_NEXT(xpg, pageq.list), + LIST_NEXT(xpg, listq.list))); + } while (++i < 500 && (xpg = LIST_NEXT(xpg, pageq.list)) != NULL); + } +#else + KASSERTMSG(LIST_NEXT(pg, pageq.list) == LIST_NEXT(pg, listq.list), + ("%s: color %d free_list %d pg %p: next %p/%p", + __func__, color, free_list, pg, + LIST_NEXT(pg, pageq.list), + LIST_NEXT(pg, listq.list))); +#endif +#endif LIST_REMOVE(pg, pageq.list); /* global list */ LIST_REMOVE(pg, listq.list); /* per-cpu list */ +#ifndef MULTIPROCESSOR + KASSERT(LIST_FIRST(&ucpu->page_free[color].pgfl_queues[free_list][try1]) == LIST_FIRST(&uvm.page_free[color].pgfl_queues[free_list][try1])); +#endif uvmexp.free--; - uvm_page_to_pggroup(pg)->pgrp_free--; + uvm.page_free[color].pgfl_pggroups[free_list]->pgrp_free--; pgfl->pgfl_pages[try1]--; gpgfl->pgfl_pages[try1]--; ucpu->pages[try1]--; @@ -1298,20 +1353,18 @@ uvm_pagealloc_strat(struct uvm_object *o hint->pgrp_hints++; pg = uvm_pagealloc_pgfl(ucpu, hint->pgrp_free_list, try1, try2, &color, anycolor); - if (pg != NULL) + if (pg != NULL) { + lcv = hint->pgrp_free_list; goto gotit; + } + /* + * Failed to get page so clear hint. + */ + uvm.page_free[color].pgfl_hint = NULL; hint->pgrp_hintfails++; } /* Check all freelists in descending priority order. */ for (lcv = 0; lcv < VM_NFREELIST; lcv++) { -#ifdef VM_FREELIST_NORMALOK_P - /* - * Verify if this freelist can be used for normal - * page allocations. - */ - if (!VM_FREELIST_NORMALOK_P(lcv)) - continue; -#endif /* * If the hint didn't help, don't try it again. */ @@ -1332,7 +1385,8 @@ uvm_pagealloc_strat(struct uvm_object *o case UVM_PGA_STRAT_FALLBACK: /* Attempt to allocate from the specified free list. */ KASSERT(free_list >= 0 && free_list < VM_NFREELIST); - pg = uvm_pagealloc_pgfl(ucpu, free_list, + lcv = free_list; + pg = uvm_pagealloc_pgfl(ucpu, lcv, try1, try2, &color, anycolor); if (pg != NULL) goto gotit; @@ -1353,6 +1407,17 @@ uvm_pagealloc_strat(struct uvm_object *o gotit: /* + * If there isn't a hint and we got a page, let's see if the page + * group has enough pages to be used as a new hint. + */ + if (__predict_false(uvm.page_free[color].pgfl_hint == NULL)) { + struct uvm_pggroup * const hint = + uvm.page_free[color].pgfl_pggroups[lcv]; + if (hint->pgrp_free >= (hint->pgrp_freetarg << 2)) { + uvm.page_free[color].pgfl_hint = hint; + } + } + /* * We now know which color we actually allocated from; set * the next color accordingly. */ @@ -1383,7 +1448,8 @@ uvm_pagealloc_strat(struct uvm_object *o pg->uanon = anon; pg->flags = PG_BUSY|PG_CLEAN|PG_FAKE; if (anon) { - struct uvm_pggroup * const grp = uvm_page_to_pggroup(pg); + struct uvm_pggroup * const grp = + uvm.page_free[color].pgfl_pggroups[lcv]; anon->an_page = pg; pg->pqflags = PQ_ANON; @@ -1400,7 +1466,7 @@ uvm_pagealloc_strat(struct uvm_object *o #if defined(UVM_PAGE_TRKOWN) pg->owner_tag = NULL; #endif - UVM_PAGE_OWN(pg, "new alloc"); + UVM_PAGE_OWN(pg, "new alloc", __builtin_return_address(0)); if (flags & UVM_PGA_ZERO) { /* @@ -1538,6 +1604,7 @@ uvm_pagefree(struct vm_page *pg) KASSERT((pg->flags & PG_PAGEOUT) == 0); KASSERT(!(pg->pqflags & PQ_FREE)); + KASSERT(mutex_owned(&uvm_pageqlock) || !uvmpdpol_pageisqueued_p(pg)); KASSERT(pg->uobject == NULL || mutex_owned(&pg->uobject->vmobjlock)); KASSERT(pg->uobject != NULL || pg->uanon == NULL || mutex_owned(&pg->uanon->an_lock)); @@ -1646,8 +1713,20 @@ uvm_pagefree(struct vm_page *pg) #endif /* DEBUG */ + /* per-cpu list */ + ucpu = curcpu()->ci_data.cpu_uvm; + struct pgfreelist * const pgfl = &ucpu->page_free[color]; + /* global list */ - struct pgfreelist *gpgfl = &uvm.page_free[color]; + struct pgfreelist * const gpgfl = &uvm.page_free[color]; + +#ifndef MULTIPROCESSOR + KASSERT(LIST_FIRST(&gpgfl->pgfl_queues[free_list][PGFL_UNKNOWN]) == LIST_FIRST(&pgfl->pgfl_queues[free_list][PGFL_UNKNOWN])); + KASSERT(LIST_FIRST(&gpgfl->pgfl_queues[free_list][PGFL_ZEROS]) == LIST_FIRST(&pgfl->pgfl_queues[free_list][PGFL_ZEROS])); + KASSERT(pgfl->pgfl_pages[PGFL_ZEROS] == gpgfl->pgfl_pages[PGFL_ZEROS]); + KASSERT(pgfl->pgfl_pages[PGFL_UNKNOWN] == gpgfl->pgfl_pages[PGFL_UNKNOWN]); +#endif + LIST_INSERT_HEAD(&gpgfl->pgfl_queues[free_list][queue], pg, pageq.list); gpgfl->pgfl_pages[queue]++; struct uvm_pggroup * const grp = gpgfl->pgfl_pggroups[free_list]; @@ -1659,10 +1738,8 @@ uvm_pagefree(struct vm_page *pg) * is only updated here (though it might cleared in pagealloc). */ grp->pgrp_free++; - if (grp->pgrp_free >= grp->pgrp_freetarg -#ifdef VM_FREELIST_NORMALOK_P - && VM_FREELIST_NORMALOK_P(free_list) -#endif + if (grp != hint + && grp->pgrp_free >= grp->pgrp_freetarg * 4 && (hint == NULL || (grp->pgrp_free - grp->pgrp_freetarg > hint->pgrp_free - hint->pgrp_freetarg))) { @@ -1675,9 +1752,7 @@ uvm_pagefree(struct vm_page *pg) } /* per-cpu list */ - ucpu = curcpu()->ci_data.cpu_uvm; pg->offset = (uintptr_t)ucpu; - struct pgfreelist *pgfl = &ucpu->page_free[color]; LIST_INSERT_HEAD(&pgfl->pgfl_queues[free_list][queue], pg, listq.list); pgfl->pgfl_pages[queue]++; ucpu->pages[queue]++; @@ -1685,6 +1760,13 @@ uvm_pagefree(struct vm_page *pg) ucpu->page_idle_zero = vm_page_zero_enable; } +#ifndef MULTIPROCESSOR + KASSERT(LIST_FIRST(&pgfl->pgfl_queues[free_list][queue]) == pg); + KASSERT(LIST_FIRST(&gpgfl->pgfl_queues[free_list][queue]) == pg); + KASSERT(pgfl->pgfl_pages[PGFL_ZEROS] == gpgfl->pgfl_pages[PGFL_ZEROS]); + KASSERT(pgfl->pgfl_pages[PGFL_UNKNOWN] == gpgfl->pgfl_pages[PGFL_UNKNOWN]); + KASSERT(LIST_NEXT(pg, pageq.list) == LIST_NEXT(pg, listq.list)); +#endif mutex_spin_exit(&uvm_fpageqlock); } @@ -1730,7 +1812,7 @@ uvm_page_unbusy(struct vm_page **pgs, in } else { UVMHIST_LOG(ubchist, "unbusying pg %p", pg,0,0,0); pg->flags &= ~(PG_WANTED|PG_BUSY); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); } } } @@ -1746,7 +1828,7 @@ uvm_page_unbusy(struct vm_page **pgs, in * => if "tag" is NULL then we are releasing page ownership */ void -uvm_page_own(struct vm_page *pg, const char *tag) +uvm_page_own(struct vm_page *pg, const char *tag, const void *addr) { struct uvm_object *uobj; struct vm_anon *anon; @@ -1767,23 +1849,22 @@ uvm_page_own(struct vm_page *pg, const c if (tag) { KASSERT((pg->flags & PG_BUSY) != 0); if (pg->owner_tag) { - printf("uvm_page_own: page %p already owned " - "by proc %d [%s]\n", pg, - pg->owner, pg->owner_tag); - panic("uvm_page_own"); + panic("uvm_page_own: page %p already owned " + "by proc %d [%s, %p]", pg, + pg->owner, pg->owner_tag, pg->owner_addr); } - pg->owner = (curproc) ? curproc->p_pid : (pid_t) -1; - pg->lowner = (curlwp) ? curlwp->l_lid : (lwpid_t) -1; + pg->owner = curproc->p_pid; + pg->lowner = curlwp->l_lid; pg->owner_tag = tag; + pg->owner_addr = addr ? addr : __builtin_return_address(0); return; } /* drop ownership */ KASSERT((pg->flags & PG_BUSY) == 0); if (pg->owner_tag == NULL) { - printf("uvm_page_own: dropping ownership of an non-owned " - "page (%p)\n", pg); - panic("uvm_page_own"); + panic("uvm_page_own: dropping ownership of an non-owned " + "page (%p)", pg); } if (!uvmpdpol_pageisqueued_p(pg)) { KASSERT((pg->uanon == NULL && pg->uobject == NULL) || @@ -1823,8 +1904,8 @@ uvm_pageidlezero(void) do { gpgfl = &uvm.page_free[nextcolor]; pgfl = &ucpu->page_free[nextcolor]; - struct pgflist *gfreeq = &gpgfl->pgfl_queues[0][0]; - struct pgflist *freeq = &pgfl->pgfl_queues[0][0]; + struct pgflist *gfreeq = &gpgfl->pgfl_queues[0][PGFL_UNKNOWN]; + struct pgflist *freeq = &pgfl->pgfl_queues[0][PGFL_UNKNOWN]; for (free_list = 0; free_list < VM_NFREELIST; free_list++, @@ -1833,18 +1914,27 @@ uvm_pageidlezero(void) if (sched_curcpu_runnable_p()) { goto quit; } - KASSERT(freeq == &pgfl->pgfl_queues[free_list][0]); + KASSERT(freeq == &pgfl->pgfl_queues[free_list][PGFL_UNKNOWN]); while ((pg = LIST_FIRST(&freeq[PGFL_UNKNOWN])) != NULL) { if (sched_curcpu_runnable_p()) { goto quit; } +#ifndef MULTIPROCESSOR + KASSERT(LIST_FIRST(&gfreeq[PGFL_UNKNOWN]) == LIST_FIRST(&freeq[PGFL_UNKNOWN])); + KASSERT(LIST_FIRST(&gfreeq[PGFL_ZEROS]) == LIST_FIRST(&freeq[PGFL_ZEROS])); + KASSERT(LIST_FIRST(&gfreeq[PGFL_UNKNOWN]) == LIST_FIRST(&freeq[PGFL_UNKNOWN])); + KASSERT(LIST_NEXT(pg, pageq.list) == LIST_NEXT(pg, listq.list)); +#endif LIST_REMOVE(pg, pageq.list); /* global list */ LIST_REMOVE(pg, listq.list); /* per-cpu list */ +#ifndef MULTIPROCESSOR + KASSERT(LIST_FIRST(&gfreeq[PGFL_UNKNOWN]) == LIST_FIRST(&freeq[PGFL_UNKNOWN])); +#endif ucpu->pages[PGFL_UNKNOWN]--; gpgfl->pgfl_pages[PGFL_UNKNOWN]--; pgfl->pgfl_pages[PGFL_UNKNOWN]--; struct uvm_pggroup * const grp = - uvm_page_to_pggroup(pg); + gpgfl->pgfl_pggroups[free_list]; grp->pgrp_free--; uvmexp.free--; KASSERT(pg->pqflags == PQ_FREE); @@ -1863,15 +1953,18 @@ uvm_pageidlezero(void) mutex_spin_enter(&uvm_fpageqlock); pg->pqflags = PQ_FREE; LIST_INSERT_HEAD(&gfreeq[PGFL_UNKNOWN], - pg, listq.list); - LIST_INSERT_HEAD(&freeq[PGFL_UNKNOWN], pg, pageq.list); + LIST_INSERT_HEAD(&freeq[PGFL_UNKNOWN], + pg, listq.list); ucpu->pages[PGFL_UNKNOWN]++; gpgfl->pgfl_pages[PGFL_UNKNOWN]++; pgfl->pgfl_pages[PGFL_UNKNOWN]++; grp->pgrp_free++; uvmexp.free++; uvmexp.zeroaborts++; +#ifndef MULTIPROCESSOR + KASSERT(LIST_FIRST(&gfreeq[PGFL_UNKNOWN]) == LIST_FIRST(&freeq[PGFL_UNKNOWN])); +#endif goto quit; } #else Index: src/sys/uvm/uvm_page.h diff -u src/sys/uvm/uvm_page.h:1.55.14.8 src/sys/uvm/uvm_page.h:1.55.14.9 --- src/sys/uvm/uvm_page.h:1.55.14.8 Thu Feb 16 04:20:45 2012 +++ src/sys/uvm/uvm_page.h Wed Feb 29 18:03:39 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.h,v 1.55.14.8 2012/02/16 04:20:45 matt Exp $ */ +/* $NetBSD: uvm_page.h,v 1.55.14.9 2012/02/29 18:03:39 matt Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -153,6 +153,7 @@ struct vm_page { pid_t owner; /* proc that set PG_BUSY */ lwpid_t lowner; /* lwp that set PG_BUSY */ const char *owner_tag; /* why it was set busy */ + const void *owner_addr; /* who allocated it */ #endif }; @@ -328,7 +329,7 @@ extern int vm_nphysseg; void uvm_page_init(vaddr_t *, vaddr_t *); #if defined(UVM_PAGE_TRKOWN) -void uvm_page_own(struct vm_page *, const char *); +void uvm_page_own(struct vm_page *, const char *, const void *); #endif #if !defined(PMAP_STEAL_MEMORY) bool uvm_page_physget(paddr_t *); Index: src/sys/uvm/uvm_pdaemon.c diff -u src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.7 src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.8 --- src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.7 Fri Feb 17 23:36:04 2012 +++ src/sys/uvm/uvm_pdaemon.c Wed Feb 29 18:03:40 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.7 2012/02/17 23:36:04 matt Exp $ */ +/* $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.8 2012/02/29 18:03:40 matt Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -71,7 +71,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.7 2012/02/17 23:36:04 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.8 2012/02/29 18:03:40 matt Exp $"); #include "opt_uvmhist.h" #include "opt_readahead.h" @@ -308,6 +308,10 @@ uvmpd_tune(void) val = (grp->pgrp_freemin * 4) / 3; if (val <= grp->pgrp_freemin) val = grp->pgrp_freemin + 1; +#ifdef VM_FREELIST_NORMALOK_P + if (!VM_FREELIST_NORMALOK_P(grp->pgrp_free_list)) + val *= 4; +#endif grp->pgrp_freetarg = val + extrapages / uvmexp.npggroups; if (grp->pgrp_freetarg > grp->pgrp_npages / 2) grp->pgrp_freetarg = grp->pgrp_npages / 2; @@ -874,7 +878,7 @@ uvmpd_scan_queue(struct uvm_pggroup *grp uvmpdpol_scaninit(grp); UVMHIST_LOG(pdhist," [%zd]: want free target (%u)", - grp - uvm.pggrous, grp->pgrp_freetarg << 2, 0, 0); + grp - uvm.pggroups, grp->pgrp_freetarg << 2, 0, 0); while (/* CONSTCOND */ 1) { /* @@ -1074,7 +1078,7 @@ uvmpd_scan_queue(struct uvm_pggroup *grp */ pg->flags |= PG_BUSY; - UVM_PAGE_OWN(pg, "scan_queue"); + UVM_PAGE_OWN(pg, "scan_queue", NULL); pg->flags |= PG_PAGEOUT; uvm_pagedequeue(pg); @@ -1088,7 +1092,7 @@ uvmpd_scan_queue(struct uvm_pggroup *grp if (swapcluster_add(&swc, pg)) { pg->flags &= ~(PG_BUSY|PG_PAGEOUT); - UVM_PAGE_OWN(pg, NULL); + UVM_PAGE_OWN(pg, NULL, NULL); mutex_enter(&uvm_pageqlock); dirtyreacts++; uvm_pageactivate(pg); Index: src/sys/uvm/uvm_pglist.c diff -u src/sys/uvm/uvm_pglist.c:1.42.16.12 src/sys/uvm/uvm_pglist.c:1.42.16.13 --- src/sys/uvm/uvm_pglist.c:1.42.16.12 Tue Feb 14 01:12:42 2012 +++ src/sys/uvm/uvm_pglist.c Wed Feb 29 18:03:40 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pglist.c,v 1.42.16.12 2012/02/14 01:12:42 matt Exp $ */ +/* $NetBSD: uvm_pglist.c,v 1.42.16.13 2012/02/29 18:03:40 matt Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.42.16.12 2012/02/14 01:12:42 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.42.16.13 2012/02/29 18:03:40 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -109,12 +109,16 @@ uvm_pglist_add(struct vm_page *pg, struc if (tp == NULL) panic("uvm_pglistalloc: page not on freelist"); #endif +#ifndef MULTIPROCESSOR + KASSERT(LIST_NEXT(pg, pageq.list) == LIST_NEXT(pg, listq.list)); + KASSERT(LIST_FIRST(&uvm.page_free[color].pgfl_queues[free_list][queue]) == LIST_FIRST(&ucpu->page_free[color].pgfl_queues[free_list][queue])); +#endif LIST_REMOVE(pg, pageq.list); /* global */ LIST_REMOVE(pg, listq.list); /* cpu */ uvm.page_free[color].pgfl_pages[queue]--; ucpu->page_free[color].pgfl_pages[queue]--; ucpu->pages[queue]--; - uvm_page_to_pggroup(pg)->pgrp_free--; + uvm.page_free[color].pgfl_pggroups[free_list]->pgrp_free--; uvmexp.free--; if (pg->flags & PG_ZERO) uvmexp.zeropages--; @@ -624,16 +628,22 @@ uvm_pglistfree(struct pglist *list) const size_t queue = iszero ? PGFL_ZEROS : PGFL_UNKNOWN; #ifndef MULTIPROCESSOR KASSERT(ucpu == uvm.cpus); + KASSERT(LIST_FIRST(&uvm.page_free[color].pgfl_queues[free_list][queue]) == LIST_FIRST(&ucpu->page_free[color].pgfl_queues[free_list][queue])); #endif pg->offset = (uintptr_t)ucpu; LIST_INSERT_HEAD(&uvm.page_free[color]. pgfl_queues[free_list][queue], pg, pageq.list); LIST_INSERT_HEAD(&ucpu->page_free[color]. pgfl_queues[free_list][queue], pg, listq.list); +#ifndef MULTIPROCESSOR + KASSERT(LIST_FIRST(&uvm.page_free[color].pgfl_queues[free_list][queue]) == pg); + KASSERT(LIST_FIRST(&ucpu->page_free[color].pgfl_queues[free_list][queue]) == pg); + KASSERT(LIST_NEXT(pg, pageq.list) == LIST_NEXT(pg, listq.list)); +#endif uvm.page_free[color].pgfl_pages[queue]++; ucpu->page_free[color].pgfl_pages[queue]++; ucpu->pages[queue]++; - uvm_page_to_pggroup(pg)->pgrp_free++; + uvm.page_free[color].pgfl_pggroups[free_list]->pgrp_free++; uvmexp.free++; if (iszero) uvmexp.zeropages++; Index: src/sys/uvm/uvm_vnode.c diff -u src/sys/uvm/uvm_vnode.c:1.90.28.3 src/sys/uvm/uvm_vnode.c:1.90.28.4 --- src/sys/uvm/uvm_vnode.c:1.90.28.3 Fri Jun 3 07:52:48 2011 +++ src/sys/uvm/uvm_vnode.c Wed Feb 29 18:03:40 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_vnode.c,v 1.90.28.3 2011/06/03 07:52:48 matt Exp $ */ +/* $NetBSD: uvm_vnode.c,v 1.90.28.4 2012/02/29 18:03:40 matt Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -50,7 +50,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.90.28.3 2011/06/03 07:52:48 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.90.28.4 2012/02/29 18:03:40 matt Exp $"); #include "fs_nfs.h" #include "opt_uvmhist.h" @@ -311,7 +311,7 @@ uvn_findpage(struct uvm_object *uobj, vo /* mark the page BUSY and we're done. */ pg->flags |= PG_BUSY; - UVM_PAGE_OWN(pg, "uvn_findpage"); + UVM_PAGE_OWN(pg, "uvn_findpage", NULL); UVMHIST_LOG(ubchist, "found %p (color %u)", pg, VM_PGCOLOR_BUCKET(pg), 0,0); break;