CVS commit: [matt-nb5-mips64] src/sys/uvm

2014-03-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Mar 24 07:37:14 UTC 2014

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.c

Log Message:
Make sure the hint is initialized to NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.140.6.3.4.11 -r1.140.6.3.4.12 src/sys/uvm/uvm_page.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/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.11 src/sys/uvm/uvm_page.c:1.140.6.3.4.12
--- src/sys/uvm/uvm_page.c:1.140.6.3.4.11	Sat Feb 15 10:19:14 2014
+++ src/sys/uvm/uvm_page.c	Mon Mar 24 07:37:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.11 2014/02/15 10:19:14 matt Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.12 2014/03/24 07:37:14 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.11 2014/02/15 10:19:14 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.140.6.3.4.12 2014/03/24 07:37:14 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -328,6 +328,7 @@ uvm_page_init_freelist(struct pgfreelist
 		for (size_t queue = 0; queue  PGFL_NQUEUES; queue++) {
 			LIST_INIT(pgfl-pgfl_queues[free_list][queue]);
 		}
+		pgfl-pgfl_hint = NULL;
 		pgfl-pgfl_pggroups[free_list] =
 		pggroups[free_list * uvmexp.ncolors + color];
 		pgfl-pgfl_pggroups[free_list]-pgrp_free_list = free_list;



CVS commit: [matt-nb5-mips64] src/sys/uvm

2014-03-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Mar 24 07:37:14 UTC 2014

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.c

Log Message:
Make sure the hint is initialized to NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.140.6.3.4.11 -r1.140.6.3.4.12 src/sys/uvm/uvm_page.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2014-02-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Feb 15 10:18:33 UTC 2014

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pmap.h

Log Message:
Add PMAP_NOCACHE + others.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.10.1 src/sys/uvm/uvm_pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_pmap.h
diff -u src/sys/uvm/uvm_pmap.h:1.23 src/sys/uvm/uvm_pmap.h:1.23.10.1
--- src/sys/uvm/uvm_pmap.h:1.23	Wed Jul 16 14:33:09 2008
+++ src/sys/uvm/uvm_pmap.h	Sat Feb 15 10:18:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pmap.h,v 1.23 2008/07/16 14:33:09 matt Exp $	*/
+/*	$NetBSD: uvm_pmap.h,v 1.23.10.1 2014/02/15 10:18:33 matt Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -86,6 +86,9 @@ typedef struct pmap_statistics	*pmap_sta
 #include machine/pmap.h
 #endif
 
+/* All accesses are uncacheable. No speculative accesses. */
+#define PMAP_NOCACHE	0x0100	/* [BOTH] */
+
 /*
  * Flags passed to pmap_enter().  Note the bottom 3 bits are VM_PROT_*
  * bits, used to indicate the access type that was made (to seed modified
@@ -101,6 +104,10 @@ typedef struct pmap_statistics	*pmap_sta
 #define	PMAP_KMPAGE	0x	/* this is from the kmem allocator */
 #endif
 
+#define PMAP_MD_MASK	0xff00	/* [BOTH] Machine-dependent bits */
+#define PMAP_PROT_MASK	0x000f	/* [BOTH] VM_PROT_* bit mask */
+
+
 #ifndef PMAP_EXCLUDE_DECLS	/* Used in Sparc port to virtualize pmap mod */
 #ifdef _KERNEL
 __BEGIN_DECLS



CVS commit: [matt-nb5-mips64] src/sys/uvm

2014-02-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Feb 15 10:19:14 UTC 2014

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.c uvm_pglist.c

Log Message:
Adapt to K{,D}ASSERTMSG changes


To generate a diff of this commit:
cvs rdiff -u -r1.140.6.3.4.10 -r1.140.6.3.4.11 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.42.16.13 -r1.42.16.14 src/sys/uvm/uvm_pglist.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/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.10 src/sys/uvm/uvm_page.c:1.140.6.3.4.11
--- src/sys/uvm/uvm_page.c:1.140.6.3.4.10	Wed Feb 29 18:03:39 2012
+++ src/sys/uvm/uvm_page.c	Sat Feb 15 10:19:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.10 2012/02/29 18:03:39 matt Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.11 2014/02/15 10:19:14 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.10 2012/02/29 18:03:39 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.140.6.3.4.11 2014/02/15 10:19:14 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -843,7 +843,6 @@ uvm_page_physload(paddr_t start, paddr_t
 		for (lcv = 0, paddr = ptoa(start) ;
  lcv  npages ; lcv++, paddr += PAGE_SIZE) {
 			pgs[lcv].phys_addr = paddr;
-			pgs[lcv].free_list = free_list;
 			if (atop(paddr) = avail_start 
 			atop(paddr) = avail_end)
 uvm_pagefree(pgs[lcv]);
@@ -1176,8 +1175,8 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu,
 		/* global, try2 */
 		if ((pg = LIST_FIRST(gfreeq[try2])) != NULL) {
 			KASSERTMSG(pg-pqflags  PQ_FREE,
-			(%s: pg %p in q %p not free!,
-			 __func__, pg, gfreeq[try2]));
+			%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
@@ -1205,18 +1204,18 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu,
 		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,
+			%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)));
+			 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,
+	%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)));
+	 LIST_NEXT(pg, listq.list));
 #endif
 #endif
 	LIST_REMOVE(pg, pageq.list);	/* global list */

Index: src/sys/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.42.16.13 src/sys/uvm/uvm_pglist.c:1.42.16.14
--- src/sys/uvm/uvm_pglist.c:1.42.16.13	Wed Feb 29 18:03:40 2012
+++ src/sys/uvm/uvm_pglist.c	Sat Feb 15 10:19:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.42.16.13 2012/02/29 18:03:40 matt Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.42.16.14 2014/02/15 10:19:14 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.13 2012/02/29 18:03:40 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.42.16.14 2014/02/15 10:19:14 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -204,22 +204,22 @@ uvm_pglistalloc_c_ps(struct vm_physseg *
 		 * Make sure this is a managed physical page.
 		 */
 		KDASSERTMSG(vm_physseg_find(try, cidx) == ps - vm_physmem,
-		(%s: %s(%#x, cidx) (%d) != ps - vm_physmem (%zd),
+		%s: %s(%#x, cidx) (%d) != ps - vm_physmem (%zd),
 		 __func__, vm_physseg_find, try,
-		vm_physseg_find(try, cidx), ps - vm_physmem));
+		vm_physseg_find(try, cidx), ps - vm_physmem);
 
 		KDASSERTMSG(cidx == try - ps-start,
-		(%s: cidx (%#x) != try (%#x) - ps-start (%#PRIxPADDR),
-		 __func__, cidx, try, ps-start));
+		%s: cidx (%#x) != try (%#x) - ps-start (%#PRIxPADDR),
+		__func__, cidx, try, ps-start);
 
 		KDASSERTMSG(vm_physseg_find(try + num - 1, cidx) == ps - vm_physmem,
-		(%s: %s(%#x + %#x - 1, cidx) (%d) != ps - vm_physmem (%zd),
-		 __func__, vm_physseg_find, try, num,
-		vm_physseg_find(try, cidx), ps - vm_physmem));
+		%s: %s(%#x + %#x - 1, cidx) (%d) != ps - vm_physmem (%zd),
+		__func__, vm_physseg_find, try, num,
+		vm_physseg_find(try, cidx), ps - vm_physmem);
 
 		KDASSERTMSG(cidx == try - ps-start + num - 1,
-		(%s: cidx (%#x) != try (%#x) - ps-start (%#PRIxPADDR) + num (%#x) - 1,
-		 __func__, cidx, try, ps-start, num));
+		%s: cidx (%#x) != try (%#x) - ps-start (%#PRIxPADDR) + num (%#x) - 1,
+		__func__, cidx, try, ps-start, 

CVS commit: [matt-nb5-mips64] src/sys/uvm

2014-02-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Feb 15 10:18:33 UTC 2014

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pmap.h

Log Message:
Add PMAP_NOCACHE + others.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.10.1 src/sys/uvm/uvm_pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2014-02-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Feb 15 10:19:14 UTC 2014

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.c uvm_pglist.c

Log Message:
Adapt to K{,D}ASSERTMSG changes


To generate a diff of this commit:
cvs rdiff -u -r1.140.6.3.4.10 -r1.140.6.3.4.11 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.42.16.13 -r1.42.16.14 src/sys/uvm/uvm_pglist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2013-12-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec 19 01:22:02 UTC 2013

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.h

Log Message:
error out if VM_NFREELIST isn't defined


To generate a diff of this commit:
cvs rdiff -u -r1.7.16.5 -r1.7.16.6 src/sys/uvm/uvm_pglist.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_pglist.h
diff -u src/sys/uvm/uvm_pglist.h:1.7.16.5 src/sys/uvm/uvm_pglist.h:1.7.16.6
--- src/sys/uvm/uvm_pglist.h:1.7.16.5	Thu Feb 16 04:20:46 2012
+++ src/sys/uvm/uvm_pglist.h	Thu Dec 19 01:22:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.h,v 1.7.16.5 2012/02/16 04:20:46 matt Exp $	*/
+/*	$NetBSD: uvm_pglist.h,v 1.7.16.6 2013/12/19 01:22:02 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -34,6 +34,9 @@
 
 #ifndef VM_NFREELIST
 #include machine/vmparam.h
+#ifndef VM_NFREELIST
+#error machine/vmparam.h did not define VM_NFREELIST
+#endif
 #endif
 
 /*



CVS commit: [matt-nb5-mips64] src/sys/uvm

2013-12-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec 19 01:22:02 UTC 2013

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.h

Log Message:
error out if VM_NFREELIST isn't defined


To generate a diff of this commit:
cvs rdiff -u -r1.7.16.5 -r1.7.16.6 src/sys/uvm/uvm_pglist.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-05-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon May  7 18:30:56 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_map.c

Log Message:
Use uvm_km_pagefree to free a kmap entry page.


To generate a diff of this commit:
cvs rdiff -u -r1.263.4.3.4.8 -r1.263.4.3.4.9 src/sys/uvm/uvm_map.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/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.263.4.3.4.8 src/sys/uvm/uvm_map.c:1.263.4.3.4.9
--- src/sys/uvm/uvm_map.c:1.263.4.3.4.8	Wed Feb 29 18:03:39 2012
+++ src/sys/uvm/uvm_map.c	Mon May  7 18:30:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.263.4.3.4.8 2012/02/29 18:03:39 matt Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.263.4.3.4.9 2012/05/07 18:30:56 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.8 2012/02/29 18:03:39 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.263.4.3.4.9 2012/05/07 18:30:56 matt Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -4782,7 +4782,7 @@ uvm_kmapent_free(struct vm_map_entry *en
 	pmap_update(vm_map_pmap(map));
 	vm_map_unlock(map);
 	pg = PHYS_TO_VM_PAGE(pa);
-	uvm_pagefree(pg);
+	uvm_km_pagefree(pg);
 	UVMMAP_EVCNT_INCR(ukh_free);
 }
 



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-05-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon May  7 18:31:25 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.8 -r1.12.16.9 src/sys/uvm/uvm_pdpolicy_clock.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/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.8 src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.9
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.8	Fri Apr 27 20:41:09 2012
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Mon May  7 18:31:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.8 2012/04/27 20:41:09 matt Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.9 2012/05/07 18:31:25 matt Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*
@@ -74,7 +74,7 @@
 #else /* defined(PDSIM) */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.8 2012/04/27 20:41:09 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.9 2012/05/07 18:31:25 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -490,7 +490,7 @@ uvmpdpol_estimatepageable(const struct u
 			*activep += gs-gs_active + gs-gs_radioactive;
 		}
 		if (inactivep) {
-			*inactivep = gs-gs_inactive;
+			*inactivep += gs-gs_inactive;
 		}
 		return;
 	}



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-05-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon May  7 18:31:55 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c

Log Message:
Fix free wakeup


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.14 -r1.93.4.2.4.15 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_pdaemon.c
diff -u src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.14 src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.15
--- src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.14	Fri Apr 27 20:41:09 2012
+++ src/sys/uvm/uvm_pdaemon.c	Mon May  7 18:31:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.14 2012/04/27 20:41:09 matt Exp $	*/
+/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.15 2012/05/07 18:31:55 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.14 2012/04/27 20:41:09 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.15 2012/05/07 18:31:55 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -510,7 +510,7 @@ uvm_pageout(void *arg)
 			}
 
 		}
-		if (need_wakeup) {
+		if (need_wakeup || (!need_free  pdinfo-pd_waiters)) {
 			wakeup(uvmexp.free);
 		}
 		KASSERT(!need_free || need_wakeup || !progress);



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-05-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon May  7 21:07:35 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_anon.c

Log Message:
Move call to uvm_anon_dropswap to with #ifdef VMSWAP


To generate a diff of this commit:
cvs rdiff -u -r1.51.28.2 -r1.51.28.3 src/sys/uvm/uvm_anon.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/uvm/uvm_anon.c
diff -u src/sys/uvm/uvm_anon.c:1.51.28.2 src/sys/uvm/uvm_anon.c:1.51.28.3
--- src/sys/uvm/uvm_anon.c:1.51.28.2	Thu Feb 16 04:20:45 2012
+++ src/sys/uvm/uvm_anon.c	Mon May  7 21:07:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_anon.c,v 1.51.28.2 2012/02/16 04:20:45 matt Exp $	*/
+/*	$NetBSD: uvm_anon.c,v 1.51.28.3 2012/05/07 21:07:34 matt Exp $	*/
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_anon.c,v 1.51.28.2 2012/02/16 04:20:45 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_anon.c,v 1.51.28.3 2012/05/07 21:07:34 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -207,13 +207,13 @@ uvm_anfree(struct vm_anon *anon)
 		uvmexp.swpgonly--;
 		mutex_exit(uvm_swap_data_lock);
 	}
-#endif /* defined(VMSWAP) */
 
 	/*
 	 * free any swap resources.
 	 */
 
 	uvm_anon_dropswap(anon);
+#endif /* defined(VMSWAP) */
 
 	/*
 	 * give a page replacement hint.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-05-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon May  7 18:30:56 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_map.c

Log Message:
Use uvm_km_pagefree to free a kmap entry page.


To generate a diff of this commit:
cvs rdiff -u -r1.263.4.3.4.8 -r1.263.4.3.4.9 src/sys/uvm/uvm_map.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-05-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon May  7 18:31:25 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.8 -r1.12.16.9 src/sys/uvm/uvm_pdpolicy_clock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-05-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon May  7 21:07:35 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_anon.c

Log Message:
Move call to uvm_anon_dropswap to with #ifdef VMSWAP


To generate a diff of this commit:
cvs rdiff -u -r1.51.28.2 -r1.51.28.3 src/sys/uvm/uvm_anon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 27 20:41:09 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c uvm_pdpolicy_clock.c

Log Message:
Don't decrement pgrp_active in radioactive page dequeue since we don't
increment it when activated a radioactive page.


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.13 -r1.93.4.2.4.14 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.12.16.7 -r1.12.16.8 src/sys/uvm/uvm_pdpolicy_clock.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/uvm/uvm_pdaemon.c
diff -u src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.13 src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.14
--- src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.13	Tue Apr 17 00:19:30 2012
+++ src/sys/uvm/uvm_pdaemon.c	Fri Apr 27 20:41:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.13 2012/04/17 00:19:30 matt Exp $	*/
+/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.14 2012/04/27 20:41:09 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.13 2012/04/17 00:19:30 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.14 2012/04/27 20:41:09 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -405,7 +405,6 @@ uvm_pageout(void *arg)
 			UVMHIST_LOG(pdhist,  WOKE UP,0,0,0,0);
 			want_tune = pdinfo-pd_stalled;
 			pdinfo-pd_stalled = false;
-			progress = false;
 		} else if (TAILQ_FIRST(pdinfo-pd_pendingq) == NULL) {
 			/*
 			 * Someone is waiting but no group are pending.
@@ -440,6 +439,7 @@ uvm_pageout(void *arg)
 		 * system only when entire pool page is empty.
 		 */
 		bool need_wakeup = false;
+		progress = false;
 		while ((grp = TAILQ_FIRST(pdinfo-pd_pendingq)) != NULL) {
 			KASSERT(grp-pgrp_npages  0);
 

Index: src/sys/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.7 src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.8
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.7	Tue Apr 17 00:12:21 2012
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Fri Apr 27 20:41:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.7 2012/04/17 00:12:21 matt Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.8 2012/04/27 20:41:09 matt Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*
@@ -74,7 +74,7 @@
 #else /* defined(PDSIM) */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.7 2012/04/17 00:12:21 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.8 2012/04/27 20:41:09 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -434,7 +434,6 @@ uvmpdpol_pagedequeue(struct vm_page *pg)
 		pg-pqflags = ~PQ_RADIOACTIVE;
 		KASSERT(gs-gs_radioactive  0);
 		gs-gs_radioactive--;
-		grp-pgrp_active--;
 	}
 
 	//KDASSERT(gs-gs_radioactive == clock_pglist_count(gs-gs_radioactiveq));



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 27 20:41:09 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c uvm_pdpolicy_clock.c

Log Message:
Don't decrement pgrp_active in radioactive page dequeue since we don't
increment it when activated a radioactive page.


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.13 -r1.93.4.2.4.14 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.12.16.7 -r1.12.16.8 src/sys/uvm/uvm_pdpolicy_clock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr 17 00:12:21 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
If freemin is 0, don't say a scan is needed.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.6 -r1.12.16.7 src/sys/uvm/uvm_pdpolicy_clock.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/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.6 src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.7
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.6	Thu Apr 12 19:39:55 2012
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Tue Apr 17 00:12:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.6 2012/04/12 19:39:55 matt Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.7 2012/04/17 00:12:21 matt Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*
@@ -74,7 +74,7 @@
 #else /* defined(PDSIM) */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.6 2012/04/12 19:39:55 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.7 2012/04/17 00:12:21 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -581,7 +581,7 @@ uvmpdpol_needsscan_p(struct uvm_pggroup 
 {
 	struct uvmpdpol_groupstate * const gs = grp-pgrp_gs;
 
-	return gs-gs_inactive  gs-gs_inactarg;
+	return grp-pgrp_freemin  0  gs-gs_inactive  gs-gs_inactarg;
 }
 
 void



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr 17 00:19:30 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c

Log Message:
Don't kick off the page daemon if it's not going to be able to do anything.


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.12 -r1.93.4.2.4.13 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_pdaemon.c
diff -u src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.12 src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.13
--- src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.12	Sat Apr 14 00:49:35 2012
+++ src/sys/uvm/uvm_pdaemon.c	Tue Apr 17 00:19:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.12 2012/04/14 00:49:35 matt Exp $	*/
+/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.13 2012/04/17 00:19:30 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.12 2012/04/14 00:49:35 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.13 2012/04/17 00:19:30 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -359,6 +359,7 @@ uvm_pageout(void *arg)
 	u_int npages = 0;
 	u_int extrapages = 0;
 	u_int npggroups = 0;
+	bool want_tune = false;
 	struct pool *pp;
 	uint64_t where;
 	struct uvm_pdinfo * const pdinfo = uvm_pdinfo;
@@ -402,6 +403,7 @@ uvm_pageout(void *arg)
 			uvm_fpageqlock, false, pgdaemon, timo);
 			uvmexp.pdwoke++;
 			UVMHIST_LOG(pdhist,  WOKE UP,0,0,0,0);
+			want_tune = pdinfo-pd_stalled;
 			pdinfo-pd_stalled = false;
 			progress = false;
 		} else if (TAILQ_FIRST(pdinfo-pd_pendingq) == NULL) {
@@ -424,11 +426,13 @@ uvm_pageout(void *arg)
 
 		if (npages != uvmexp.npages
 		|| extrapages != uvm_extrapages
-		|| npggroups != uvmexp.npggroups) {
+		|| npggroups != uvmexp.npggroups
+		|| want_tune) {
 			npages = uvmexp.npages;
 			extrapages = uvm_extrapages;
 			npggroups = uvmexp.npggroups;
 			uvmpd_tune();
+			want_tune = false;
 		}
 
 		/*
@@ -478,6 +482,14 @@ uvm_pageout(void *arg)
 	local_progress = true;
 }
 mutex_spin_enter(uvm_fpageqlock);
+if (!local_progress) {
+	/*
+	 * This should stop kick_pdaemon from
+	 * trying to reclaim pages until
+	 * another tune resets it.
+	 */
+	grp-pgrp_freemin = 0;
+}
 			} else {
 UVMHIST_LOG(pdhist,
  [%zu]: diff/paging=%u/%u: 
@@ -491,8 +503,9 @@ uvm_pageout(void *arg)
 			 * wake up any waiters but only if we made progress for
 			 * this group.
 			 */
-			if (grp-pgrp_free * uvmexp.npggroups  uvmexp.reserve_kernel
-			|| (local_progress  grp-pgrp_paging == 0)) {
+			if (local_progress
+			   (grp-pgrp_free * uvmexp.npggroups  uvmexp.reserve_kernel
+  || grp-pgrp_paging == 0)) {
 need_wakeup = true;
 			}
 
@@ -500,7 +513,7 @@ uvm_pageout(void *arg)
 		if (need_wakeup) {
 			wakeup(uvmexp.free);
 		}
-		KASSERT(!need_free || need_wakeup);
+		KASSERT(!need_free || need_wakeup || !progress);
 		mutex_spin_exit(uvm_fpageqlock);
 
 		/*



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr 17 00:12:21 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
If freemin is 0, don't say a scan is needed.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.6 -r1.12.16.7 src/sys/uvm/uvm_pdpolicy_clock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr 17 00:19:30 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c

Log Message:
Don't kick off the page daemon if it's not going to be able to do anything.


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.12 -r1.93.4.2.4.13 src/sys/uvm/uvm_pdaemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Apr 14 00:49:36 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c

Log Message:
If the pagedaemon is stalling, don't wake it.  Unless pages were freed for
a group, don't wake things up if paging is 0 (stop spurious wakeups).


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.11 -r1.93.4.2.4.12 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_pdaemon.c
diff -u src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.11 src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.12
--- src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.11	Fri Apr 13 00:34:54 2012
+++ src/sys/uvm/uvm_pdaemon.c	Sat Apr 14 00:49:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.11 2012/04/13 00:34:54 matt Exp $	*/
+/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.12 2012/04/14 00:49:35 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.11 2012/04/13 00:34:54 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.12 2012/04/14 00:49:35 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -113,6 +113,7 @@ static struct uvm_pdinfo {
 	unsigned int pd_scans_neededs;
 	struct uvm_pggrouplist pd_pagingq;
 	struct uvm_pggrouplist pd_pendingq;
+	bool pd_stalled;
 } uvm_pdinfo =  {
 	.pd_pagingq = TAILQ_HEAD_INITIALIZER(uvm_pdinfo.pd_pagingq),
 	.pd_pendingq = TAILQ_HEAD_INITIALIZER(uvm_pdinfo.pd_pendingq),
@@ -168,7 +169,8 @@ uvm_wait(const char *wmsg)
 	}
 
 	uvm_pdinfo.pd_waiters++;
-	wakeup(uvm.pagedaemon);		/* wake the daemon! */
+	if (!uvm_pdinfo.pd_stalled)
+		wakeup(uvm.pagedaemon);		/* wake the daemon! */
 	UVM_UNLOCK_AND_WAIT(uvmexp.free, uvm_fpageqlock, false, wmsg, timo);
 	uvm_pdinfo.pd_waiters--;
 }
@@ -269,11 +271,12 @@ uvm_kick_pdaemon(void)
 		}
 	}
 
-	if (need_wakeup)
+	const bool stalled = pdinfo-pd_stalled;
+	if (need_wakeup  !stalled)
 		wakeup(uvm.pagedaemon);
 
-	UVMHIST_LOG(pdhist,  - done: wakeup=%d!,
-	need_wakeup, 0, 0, 0);
+	UVMHIST_LOG(pdhist,  - done: wakeup=%d stalled=%d!,
+	need_wakeup, stalled, 0, 0);
 }
 
 /*
@@ -392,13 +395,14 @@ uvm_pageout(void *arg)
 		|| (pdinfo-pd_waiters == 0
 		 TAILQ_FIRST(pdinfo-pd_pendingq) == NULL)) {
 			UVMHIST_LOG(pdhist,  SLEEPING,0,0,0,0);
-			int timo = 0;
-			if (!progress  pdinfo-pd_waiters  0)
-timo = 2 * hz;
+			pdinfo-pd_stalled = !progress
+			 pdinfo-pd_waiters  0;
+			int timo = (pdinfo-pd_stalled ? 2 * hz : 0);
 			UVM_UNLOCK_AND_WAIT(uvm.pagedaemon,
 			uvm_fpageqlock, false, pgdaemon, timo);
 			uvmexp.pdwoke++;
 			UVMHIST_LOG(pdhist,  WOKE UP,0,0,0,0);
+			pdinfo-pd_stalled = false;
 			progress = false;
 		} else if (TAILQ_FIRST(pdinfo-pd_pendingq) == NULL) {
 			/*
@@ -465,11 +469,14 @@ uvm_pageout(void *arg)
 			/*
 			 * scan if needed
 			 */
+			bool local_progress = false;
 			if (grp-pgrp_paging  diff
 			|| uvmpdpol_needsscan_p(grp)) {
 mutex_spin_exit(uvm_fpageqlock);
-if (uvmpd_scan(grp))
+if (uvmpd_scan(grp)) {
 	progress = true;
+	local_progress = true;
+}
 mutex_spin_enter(uvm_fpageqlock);
 			} else {
 UVMHIST_LOG(pdhist,
@@ -480,11 +487,12 @@ uvm_pageout(void *arg)
 			}
 
 			/*
-			 * if there's any free memory to be had,
-			 * wake up any waiters.
+			 * if there's any free memory to be had for this group,
+			 * wake up any waiters but only if we made progress for
+			 * this group.
 			 */
 			if (grp-pgrp_free * uvmexp.npggroups  uvmexp.reserve_kernel
-			|| grp-pgrp_paging == 0) {
+			|| (local_progress  grp-pgrp_paging == 0)) {
 need_wakeup = true;
 			}
 
@@ -492,7 +500,7 @@ uvm_pageout(void *arg)
 		if (need_wakeup) {
 			wakeup(uvmexp.free);
 		}
-		KASSERT (!need_free || need_wakeup);
+		KASSERT(!need_free || need_wakeup);
 		mutex_spin_exit(uvm_fpageqlock);
 
 		/*
@@ -1233,17 +1241,14 @@ uvmpd_scan(struct uvm_pggroup *grp)
 bool
 uvm_reclaimable(u_int color, bool kmem_p)
 {
-	u_int filepages, npages;
-	u_int active, inactive;
-
 	KASSERT(color  uvmexp.ncolors);
 
 	/*
 	 * if swap is not full, no problem.
 	 */
-
 #ifdef VMSWAP
 	if (!uvm_swapisfull()) {
+		KASSERT(uvmexp.nswapdev  0);
 		return true;
 	}
 #endif
@@ -1257,10 +1262,10 @@ uvm_reclaimable(u_int color, bool kmem_p
 	 * XXX should consider about other reclaimable memory.
 	 * XXX ie. pools, traditional buffer cache.
 	 */
-	active = 0;
-	inactive = 0;
-	filepages = 0;
-	npages = 0;
+	u_int active = 0;
+	u_int inactive = 0;
+	u_int filepages = 0;
+	u_int npages = 0;
 	for (u_int lcv = 0; lcv  VM_NFREELIST; lcv++) {
 		struct uvm_pggroup * const grp =
 		uvm.page_free[color].pgfl_pggroups[lcv];
@@ -1294,8 +1299,8 @@ uvm_reclaimable(u_int color, bool kmem_p
 
 void
 uvm_estimatepageable(const struct uvm_pggroup *grp,
-	u_int *active, u_int 

Re: CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-12 Thread YAMAMOTO Takashi
 
 On Apr 11, 2012, at 7:34 PM, YAMAMOTO Takashi wrote:
 
 hi,
 
 Module Name:src
 Committed By:   matt
 Date:   Thu Apr 12 01:40:27 UTC 2012
 
 Modified Files:
 src/sys/uvm [matt-nb5-mips64]: uvm_extern.h uvm_fault.c uvm_km.c
 uvm_meter.c uvm_pdaemon.c uvm_pdaemon.h uvm_pdpolicy.h
 uvm_pdpolicy_clock.c uvm_stat.c
 
 Log Message:
 Separate object-less anon pages out of the active list if there is no swap
 device.  Make uvm_reclaimable and uvm.*estimatable understand colors and
 kmem allocations.
 
 i like the idea.
 
 - why the queue is inside the pdpolicy?
 
 - why don't you use PQ_SWAPBACKED?
 
 that's only set when a swap slot has been allocated for it.  Since there's no 
 swap, it'll never be set.

the availability of swap slots doesn't affect PQ_SWAPBACKED.
it's always set for anon/aobj pages.

YAMAMOTO Takashi

 
 The problem I'm attacking is memory exhaustion.  Making sure that's pdaemon 
 isn't consuming too many resources when it can't do anything.  the pdaemon 
 would spin continuously with dirty reactivations and the above was an attempt 
 to stop that.
 
 It's still a work-in-progress.


CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 12 19:38:27 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_fault.c uvm_km.c

Log Message:
Apply colormask to get a valid color.


To generate a diff of this commit:
cvs rdiff -u -r1.125.6.1.4.5 -r1.125.6.1.4.6 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.101.4.2.4.10 -r1.101.4.2.4.11 src/sys/uvm/uvm_km.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/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.125.6.1.4.5 src/sys/uvm/uvm_fault.c:1.125.6.1.4.6
--- src/sys/uvm/uvm_fault.c:1.125.6.1.4.5	Thu Apr 12 01:40:27 2012
+++ src/sys/uvm/uvm_fault.c	Thu Apr 12 19:38:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.125.6.1.4.5 2012/04/12 01:40:27 matt Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.125.6.1.4.6 2012/04/12 19:38:27 matt Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.125.6.1.4.5 2012/04/12 01:40:27 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.125.6.1.4.6 2012/04/12 19:38:27 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -369,7 +369,8 @@ uvmfault_anonget(struct uvm_faultinfo *u
 uvmexp.fltnoram++;
 UVMHIST_LOG(maphist,   noram -- UVM_WAIT,0,
 0,0,0);
-if (!uvm_reclaimable(atop(ufi-orig_rvaddr),
+if (!uvm_reclaimable(
+atop(ufi-orig_rvaddr)  uvmexp.colormask,
 false)) {
 	return ENOMEM;
 }
@@ -643,7 +644,8 @@ uvmfault_promote(struct uvm_faultinfo *u
 		uvm_page_unbusy(uobjpage, 1);
 		uvmfault_unlockall(ufi, amap, uobj, oanon);
 nomem:
-		if (!uvm_reclaimable(atop(ufi-orig_rvaddr), false)) {
+		if (!uvm_reclaimable(
+			atop(ufi-orig_rvaddr)  uvmexp.colormask, false)) {
 			UVMHIST_LOG(maphist, out of VM, 0,0,0,0);
 			uvmexp.fltnoanon++;
 			error = ENOMEM;
@@ -1406,7 +1408,8 @@ ReFault:
 		if (anon != oanon)
 			mutex_exit(anon-an_lock);
 		uvmfault_unlockall(ufi, amap, uobj, oanon);
-		if (!uvm_reclaimable(atop(ufi.orig_rvaddr), false)) {
+		if (!uvm_reclaimable(
+			atop(ufi.orig_rvaddr)  uvmexp.colormask, false)) {
 			UVMHIST_LOG(maphist,
 			- failed.  out of VM,0,0,0,0);
 			/* XXX instrumentation */
@@ -1791,7 +1794,8 @@ Case2:
 		pg-flags = ~(PG_BUSY|PG_FAKE|PG_WANTED);
 		UVM_PAGE_OWN(pg, NULL, NULL);
 		uvmfault_unlockall(ufi, amap, uobj, anon);
-		if (!uvm_reclaimable(atop(ufi.orig_rvaddr), false)) {
+		if (!uvm_reclaimable(
+			atop(ufi.orig_rvaddr)  uvmexp.colormask, false)) {
 			UVMHIST_LOG(maphist,
 			- failed.  out of VM,0,0,0,0);
 			/* XXX instrumentation */

Index: src/sys/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.101.4.2.4.10 src/sys/uvm/uvm_km.c:1.101.4.2.4.11
--- src/sys/uvm/uvm_km.c:1.101.4.2.4.10	Thu Apr 12 01:40:27 2012
+++ src/sys/uvm/uvm_km.c	Thu Apr 12 19:38:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.10 2012/04/12 01:40:27 matt Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.11 2012/04/12 19:38:27 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.10 2012/04/12 01:40:27 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.101.4.2.4.11 2012/04/12 19:38:27 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -617,9 +617,10 @@ uvm_km_alloc(struct vm_map *map, vsize_t
 		 */
 
 		if (__predict_false(pg == NULL)) {
-			if ((flags  UVM_KMF_NOWAIT) ||
-			((flags  UVM_KMF_CANFAIL)
-			 !uvm_reclaimable(atop(offset), true))) {
+			if ((flags  UVM_KMF_NOWAIT)
+			|| ((flags  UVM_KMF_CANFAIL)
+			 !uvm_reclaimable(
+atop(offset)  uvmexp.colormask, true))) {
 /* free everything! */
 uvm_km_free(map, kva, size,
 flags  UVM_KMF_TYPEMASK);



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 12 19:39:55 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Use PQ_SWAPBACKED to determine radioactiveness of page.
Make sure to add in number of radioactive pages to actives pages.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.5 -r1.12.16.6 src/sys/uvm/uvm_pdpolicy_clock.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/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.5 src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.6
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.5	Thu Apr 12 01:40:27 2012
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Thu Apr 12 19:39:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.5 2012/04/12 01:40:27 matt Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.6 2012/04/12 19:39:55 matt Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*
@@ -74,7 +74,7 @@
 #else /* defined(PDSIM) */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.5 2012/04/12 01:40:27 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.6 2012/04/12 19:39:55 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -348,7 +348,7 @@ uvmpdpol_pagedeactivate(struct vm_page *
 	 * a backing store, don't bother marking it INACTIVE since it would
 	 * only be a dirty reactivation.
 	 */
-	if (uvmexp.nswapdev  1  pg-uobject == NULL  pg-uanon != NULL) {
+	if (uvmexp.nswapdev  1  (pg-pqflags  PQ_SWAPBACKED) != 0) {
 		KASSERT(pg-pqflags  PQ_RADIOACTIVE);
 		return;
 	}
@@ -405,7 +405,7 @@ uvmpdpol_pageactivate(struct vm_page *pg
 	KASSERT(mutex_owned(uvm_pageqlock));
 
 	uvmpdpol_pagedequeue(pg);
-	if (uvmexp.nswapdev  1  pg-uanon != NULL  pg-uobject == NULL) {
+	if (uvmexp.nswapdev  1  (pg-pqflags  PQ_SWAPBACKED) != 0) {
 		TAILQ_INSERT_TAIL(gs-gs_radioactiveq, pg, pageq.queue);
 		pg-pqflags |= PQ_RADIOACTIVE;
 		gs-gs_radioactive++;
@@ -488,7 +488,7 @@ uvmpdpol_estimatepageable(const struct u
 	if (grp != NULL) {
 		struct uvmpdpol_groupstate * const gs = grp-pgrp_gs;
 		if (activep) {
-			*activep += gs-gs_active;
+			*activep += gs-gs_active + gs-gs_radioactive;
 		}
 		if (inactivep) {
 			*inactivep = gs-gs_inactive;
@@ -503,7 +503,7 @@ uvmpdpol_estimatepageable(const struct u
 		//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
 		//KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
 
-		active += gs-gs_active;
+		active += gs-gs_active + gs-gs_radioactive;
 		inactive += gs-gs_inactive;
 	}
 



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 12 19:41:57 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c

Log Message:
If after the pagedaemon is woken and it processes the queues and make no
progress (frees no pages), instead of immediately trying again, wait 2 seconds.


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.9 -r1.93.4.2.4.10 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_pdaemon.c
diff -u src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.9 src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.10
--- src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.9	Thu Apr 12 01:40:27 2012
+++ src/sys/uvm/uvm_pdaemon.c	Thu Apr 12 19:41:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.9 2012/04/12 01:40:27 matt Exp $	*/
+/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.10 2012/04/12 19:41:57 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.9 2012/04/12 01:40:27 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.10 2012/04/12 19:41:57 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -102,7 +102,7 @@ __KERNEL_RCSID(0, $NetBSD: uvm_pdaemon.
  * local prototypes
  */
 
-static void	uvmpd_scan(struct uvm_pggroup *);
+static bool	uvmpd_scan(struct uvm_pggroup *);
 static void	uvmpd_scan_queue(struct uvm_pggroup *);
 static void	uvmpd_tune(void);
 
@@ -359,6 +359,7 @@ uvm_pageout(void *arg)
 	struct pool *pp;
 	uint64_t where;
 	struct uvm_pdinfo * const pdinfo = uvm_pdinfo;
+	bool progress = true;
 	UVMHIST_FUNC(uvm_pageout); UVMHIST_CALLED(pdhist);
 
 	UVMHIST_LOG(pdhist,starting uvm pagedaemon, 0, 0, 0, 0);
@@ -387,13 +388,18 @@ uvm_pageout(void *arg)
 		 * If we have no one waiting or all color requests have
 		 * active paging, then wait.
 		 */
-		if (pdinfo-pd_waiters == 0
-		 TAILQ_FIRST(pdinfo-pd_pendingq) == NULL) {
+		if (progress == false
+		|| (pdinfo-pd_waiters == 0
+		 TAILQ_FIRST(pdinfo-pd_pendingq) == NULL)) {
 			UVMHIST_LOG(pdhist,  SLEEPING,0,0,0,0);
+			int timo = 0;
+			if (!progress  pdinfo-pd_waiters  0)
+timo = 2 * hz;
 			UVM_UNLOCK_AND_WAIT(uvm.pagedaemon,
-			uvm_fpageqlock, false, pgdaemon, 0);
+			uvm_fpageqlock, false, pgdaemon, timo);
 			uvmexp.pdwoke++;
 			UVMHIST_LOG(pdhist,  WOKE UP,0,0,0,0);
+			progress = false;
 		} else if (TAILQ_FIRST(pdinfo-pd_pendingq) == NULL) {
 			/*
 			 * Someone is waiting but no group are pending.
@@ -462,7 +468,8 @@ uvm_pageout(void *arg)
 			if (grp-pgrp_paging  diff
 			|| uvmpdpol_needsscan_p(grp)) {
 mutex_spin_exit(uvm_fpageqlock);
-uvmpd_scan(grp);
+if (uvmpd_scan(grp))
+	progress = true;
 mutex_spin_enter(uvm_fpageqlock);
 			} else {
 UVMHIST_LOG(pdhist,
@@ -1157,7 +1164,7 @@ uvmpd_scan_queue(struct uvm_pggroup *grp
  * = called with pageq's locked
  */
 
-static void
+static bool
 uvmpd_scan(struct uvm_pggroup *grp)
 {
 	u_int swap_shortage, pages_freed;
@@ -1184,10 +1191,10 @@ uvmpd_scan(struct uvm_pggroup *grp)
 	 */
 
 	swap_shortage = 0;
-	if (grp-pgrp_free  grp-pgrp_freetarg 
-	uvmexp.swpginuse = uvmexp.swpgavail 
-	!uvm_swapisfull() 
-	pages_freed == 0) {
+	if (pages_freed == 0
+	 grp-pgrp_free  grp-pgrp_freetarg
+	 uvmexp.swpginuse = uvmexp.swpgavail
+	 !uvm_swapisfull()) {
 		swap_shortage = grp-pgrp_freetarg - grp-pgrp_free;
 	}
 
@@ -1198,6 +1205,7 @@ uvmpd_scan(struct uvm_pggroup *grp)
 	 * free target.  we need to unlock the page queues for this.
 	 */
 
+#ifdef VMSWAP
 	if (grp-pgrp_free  grp-pgrp_freemin
 	 uvmexp.nswapdev != 0  uvm.swapout_enabled) {
 		grp-pgrp_pdswout++;
@@ -1208,6 +1216,9 @@ uvmpd_scan(struct uvm_pggroup *grp)
 		mutex_enter(uvm_pageqlock);
 
 	}
+#endif /* VMSWAP */
+
+	return pages_freed != 0;
 }
 
 /*



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 13 00:34:54 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c

Log Message:
Make sure color passed to uvm_reclaimable is valid.


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.10 -r1.93.4.2.4.11 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_pdaemon.c
diff -u src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.10 src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.11
--- src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.10	Thu Apr 12 19:41:57 2012
+++ src/sys/uvm/uvm_pdaemon.c	Fri Apr 13 00:34:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.10 2012/04/12 19:41:57 matt Exp $	*/
+/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.11 2012/04/13 00:34:54 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.10 2012/04/12 19:41:57 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.11 2012/04/13 00:34:54 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -1236,6 +1236,8 @@ uvm_reclaimable(u_int color, bool kmem_p
 	u_int filepages, npages;
 	u_int active, inactive;
 
+	KASSERT(color  uvmexp.ncolors);
+
 	/*
 	 * if swap is not full, no problem.
 	 */



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 12 19:38:27 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_fault.c uvm_km.c

Log Message:
Apply colormask to get a valid color.


To generate a diff of this commit:
cvs rdiff -u -r1.125.6.1.4.5 -r1.125.6.1.4.6 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.101.4.2.4.10 -r1.101.4.2.4.11 src/sys/uvm/uvm_km.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 12 19:39:55 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Use PQ_SWAPBACKED to determine radioactiveness of page.
Make sure to add in number of radioactive pages to actives pages.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.5 -r1.12.16.6 src/sys/uvm/uvm_pdpolicy_clock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 13 00:34:54 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c

Log Message:
Make sure color passed to uvm_reclaimable is valid.


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.10 -r1.93.4.2.4.11 src/sys/uvm/uvm_pdaemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-11 Thread YAMAMOTO Takashi
hi,

 Module Name:  src
 Committed By: matt
 Date: Thu Apr 12 01:40:27 UTC 2012
 
 Modified Files:
   src/sys/uvm [matt-nb5-mips64]: uvm_extern.h uvm_fault.c uvm_km.c
   uvm_meter.c uvm_pdaemon.c uvm_pdaemon.h uvm_pdpolicy.h
   uvm_pdpolicy_clock.c uvm_stat.c
 
 Log Message:
 Separate object-less anon pages out of the active list if there is no swap
 device.  Make uvm_reclaimable and uvm.*estimatable understand colors and
 kmem allocations.

i like the idea.

- why the queue is inside the pdpolicy?

- why don't you use PQ_SWAPBACKED?

YAMAMOTO Takashi

 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.148.4.2.4.5 -r1.148.4.2.4.6 src/sys/uvm/uvm_extern.h
 cvs rdiff -u -r1.125.6.1.4.4 -r1.125.6.1.4.5 src/sys/uvm/uvm_fault.c
 cvs rdiff -u -r1.101.4.2.4.9 -r1.101.4.2.4.10 src/sys/uvm/uvm_km.c
 cvs rdiff -u -r1.49.16.3 -r1.49.16.4 src/sys/uvm/uvm_meter.c
 cvs rdiff -u -r1.93.4.2.4.8 -r1.93.4.2.4.9 src/sys/uvm/uvm_pdaemon.c
 cvs rdiff -u -r1.15 -r1.15.28.1 src/sys/uvm/uvm_pdaemon.h
 cvs rdiff -u -r1.3.62.1 -r1.3.62.2 src/sys/uvm/uvm_pdpolicy.h
 cvs rdiff -u -r1.12.16.4 -r1.12.16.5 src/sys/uvm/uvm_pdpolicy_clock.c
 cvs rdiff -u -r1.31.12.3 -r1.31.12.4 src/sys/uvm/uvm_stat.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.


Re: CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-11 Thread Matt Thomas

On Apr 11, 2012, at 7:34 PM, YAMAMOTO Takashi wrote:

 hi,
 
 Module Name: src
 Committed By:matt
 Date:Thu Apr 12 01:40:27 UTC 2012
 
 Modified Files:
  src/sys/uvm [matt-nb5-mips64]: uvm_extern.h uvm_fault.c uvm_km.c
  uvm_meter.c uvm_pdaemon.c uvm_pdaemon.h uvm_pdpolicy.h
  uvm_pdpolicy_clock.c uvm_stat.c
 
 Log Message:
 Separate object-less anon pages out of the active list if there is no swap
 device.  Make uvm_reclaimable and uvm.*estimatable understand colors and
 kmem allocations.
 
 i like the idea.
 
 - why the queue is inside the pdpolicy?
 
 - why don't you use PQ_SWAPBACKED?

that's only set when a swap slot has been allocated for it.  Since there's no 
swap, it'll never be set.

The problem I'm attacking is memory exhaustion.  Making sure that's pdaemon 
isn't consuming too many resources when it can't do anything.  the pdaemon 
would spin continuously with dirty reactivations and the above was an attempt 
to stop that.

It's still a work-in-progress.

CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 12 01:40:27 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_extern.h uvm_fault.c uvm_km.c
uvm_meter.c uvm_pdaemon.c uvm_pdaemon.h uvm_pdpolicy.h
uvm_pdpolicy_clock.c uvm_stat.c

Log Message:
Separate object-less anon pages out of the active list if there is no swap
device.  Make uvm_reclaimable and uvm.*estimatable understand colors and
kmem allocations.


To generate a diff of this commit:
cvs rdiff -u -r1.148.4.2.4.5 -r1.148.4.2.4.6 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.125.6.1.4.4 -r1.125.6.1.4.5 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.101.4.2.4.9 -r1.101.4.2.4.10 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.49.16.3 -r1.49.16.4 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.93.4.2.4.8 -r1.93.4.2.4.9 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.15 -r1.15.28.1 src/sys/uvm/uvm_pdaemon.h
cvs rdiff -u -r1.3.62.1 -r1.3.62.2 src/sys/uvm/uvm_pdpolicy.h
cvs rdiff -u -r1.12.16.4 -r1.12.16.5 src/sys/uvm/uvm_pdpolicy_clock.c
cvs rdiff -u -r1.31.12.3 -r1.31.12.4 src/sys/uvm/uvm_stat.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/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.148.4.2.4.5 src/sys/uvm/uvm_extern.h:1.148.4.2.4.6
--- src/sys/uvm/uvm_extern.h:1.148.4.2.4.5	Thu Feb  9 03:04:59 2012
+++ src/sys/uvm/uvm_extern.h	Thu Apr 12 01:40:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.148.4.2.4.5 2012/02/09 03:04:59 matt Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.148.4.2.4.6 2012/04/12 01:40:26 matt Exp $	*/
 
 /*
  *
@@ -729,7 +729,8 @@ void			uvm_aiodone_worker(struct work *,
 struct uvm_pggroup;
 void			uvm_pageout_start(struct uvm_pggroup *, u_int);
 void			uvm_pageout_done(struct vm_page *, bool);
-void			uvm_estimatepageable(u_int *, u_int *);
+void			uvm_estimatepageable(const struct uvm_pggroup *,
+			u_int *, u_int *);
 
 /* uvm_pglist.c */
 int			uvm_pglistalloc(psize_t, paddr_t, paddr_t,

Index: src/sys/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.125.6.1.4.4 src/sys/uvm/uvm_fault.c:1.125.6.1.4.5
--- src/sys/uvm/uvm_fault.c:1.125.6.1.4.4	Wed Feb 29 18:03:38 2012
+++ src/sys/uvm/uvm_fault.c	Thu Apr 12 01:40:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.125.6.1.4.4 2012/02/29 18:03:38 matt Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.125.6.1.4.5 2012/04/12 01:40:27 matt Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.125.6.1.4.4 2012/02/29 18:03:38 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.125.6.1.4.5 2012/04/12 01:40:27 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -369,7 +369,8 @@ uvmfault_anonget(struct uvm_faultinfo *u
 uvmexp.fltnoram++;
 UVMHIST_LOG(maphist,   noram -- UVM_WAIT,0,
 0,0,0);
-if (!uvm_reclaimable()) {
+if (!uvm_reclaimable(atop(ufi-orig_rvaddr),
+false)) {
 	return ENOMEM;
 }
 uvm_wait(flt_noram1);
@@ -642,7 +643,7 @@ uvmfault_promote(struct uvm_faultinfo *u
 		uvm_page_unbusy(uobjpage, 1);
 		uvmfault_unlockall(ufi, amap, uobj, oanon);
 nomem:
-		if (!uvm_reclaimable()) {
+		if (!uvm_reclaimable(atop(ufi-orig_rvaddr), false)) {
 			UVMHIST_LOG(maphist, out of VM, 0,0,0,0);
 			uvmexp.fltnoanon++;
 			error = ENOMEM;
@@ -1405,7 +1406,7 @@ ReFault:
 		if (anon != oanon)
 			mutex_exit(anon-an_lock);
 		uvmfault_unlockall(ufi, amap, uobj, oanon);
-		if (!uvm_reclaimable()) {
+		if (!uvm_reclaimable(atop(ufi.orig_rvaddr), false)) {
 			UVMHIST_LOG(maphist,
 			- failed.  out of VM,0,0,0,0);
 			/* XXX instrumentation */
@@ -1790,7 +1791,7 @@ Case2:
 		pg-flags = ~(PG_BUSY|PG_FAKE|PG_WANTED);
 		UVM_PAGE_OWN(pg, NULL, NULL);
 		uvmfault_unlockall(ufi, amap, uobj, anon);
-		if (!uvm_reclaimable()) {
+		if (!uvm_reclaimable(atop(ufi.orig_rvaddr), false)) {
 			UVMHIST_LOG(maphist,
 			- failed.  out of VM,0,0,0,0);
 			/* XXX instrumentation */

Index: src/sys/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.101.4.2.4.9 src/sys/uvm/uvm_km.c:1.101.4.2.4.10
--- src/sys/uvm/uvm_km.c:1.101.4.2.4.9	Wed Feb 29 18:03:38 2012
+++ src/sys/uvm/uvm_km.c	Thu Apr 12 01:40:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.9 2012/02/29 18:03:38 matt Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.10 2012/04/12 01:40:27 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.9 2012/02/29 18:03:38 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.101.4.2.4.10 2012/04/12 01:40:27 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -618,7 +618,8 @@ uvm_km_alloc(struct vm_map *map, vsize_t
 
 		if (__predict_false(pg == NULL)) {
 			if ((flags  UVM_KMF_NOWAIT) ||
-			((flags  UVM_KMF_CANFAIL)  !uvm_reclaimable())) {
+			((flags  UVM_KMF_CANFAIL)
+			 !uvm_reclaimable(atop(offset), true))) {
 /* free everything! */
 

CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 12 01:40:27 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_extern.h uvm_fault.c uvm_km.c
uvm_meter.c uvm_pdaemon.c uvm_pdaemon.h uvm_pdpolicy.h
uvm_pdpolicy_clock.c uvm_stat.c

Log Message:
Separate object-less anon pages out of the active list if there is no swap
device.  Make uvm_reclaimable and uvm.*estimatable understand colors and
kmem allocations.


To generate a diff of this commit:
cvs rdiff -u -r1.148.4.2.4.5 -r1.148.4.2.4.6 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.125.6.1.4.4 -r1.125.6.1.4.5 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.101.4.2.4.9 -r1.101.4.2.4.10 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.49.16.3 -r1.49.16.4 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.93.4.2.4.8 -r1.93.4.2.4.9 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.15 -r1.15.28.1 src/sys/uvm/uvm_pdaemon.h
cvs rdiff -u -r1.3.62.1 -r1.3.62.2 src/sys/uvm/uvm_pdpolicy.h
cvs rdiff -u -r1.12.16.4 -r1.12.16.5 src/sys/uvm/uvm_pdpolicy_clock.c
cvs rdiff -u -r1.31.12.3 -r1.31.12.4 src/sys/uvm/uvm_stat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Apr  4 00:26:26 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_init.c uvm_swap.c

Log Message:
Move the uvm_scheduler_mutex and cv init to uvm_init since they are
independent of VMSWAP.


To generate a diff of this commit:
cvs rdiff -u -r1.34.12.1 -r1.34.12.2 src/sys/uvm/uvm_init.c
cvs rdiff -u -r1.140.4.1 -r1.140.4.1.4.1 src/sys/uvm/uvm_swap.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/uvm/uvm_init.c
diff -u src/sys/uvm/uvm_init.c:1.34.12.1 src/sys/uvm/uvm_init.c:1.34.12.2
--- src/sys/uvm/uvm_init.c:1.34.12.1	Thu Feb  9 03:04:59 2012
+++ src/sys/uvm/uvm_init.c	Wed Apr  4 00:26:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_init.c,v 1.34.12.1 2012/02/09 03:04:59 matt Exp $	*/
+/*	$NetBSD: uvm_init.c,v 1.34.12.2 2012/04/04 00:26:25 matt Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_init.c,v 1.34.12.1 2012/02/09 03:04:59 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_init.c,v 1.34.12.2 2012/04/04 00:26:25 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -190,4 +190,12 @@ uvm_init(void)
 	 */
 
 	uvm_ra_init();
+
+	/*
+	 * Init scheduler mutex/cv.
+	 */
+	cv_init(uvm.scheduler_cv, schedule);
+	/* XXXSMP should be at IPL_VM, but for audio interrupt handlers. */
+	mutex_init(uvm_scheduler_mutex, MUTEX_SPIN, IPL_SCHED);
+
 }

Index: src/sys/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.140.4.1 src/sys/uvm/uvm_swap.c:1.140.4.1.4.1
--- src/sys/uvm/uvm_swap.c:1.140.4.1	Sat Dec 27 18:22:49 2008
+++ src/sys/uvm/uvm_swap.c	Wed Apr  4 00:26:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.140.4.1 2008/12/27 18:22:49 snj Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.140.4.1.4.1 2012/04/04 00:26:25 matt Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_swap.c,v 1.140.4.1 2008/12/27 18:22:49 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_swap.c,v 1.140.4.1.4.1 2012/04/04 00:26:25 matt Exp $);
 
 #include fs_nfs.h
 #include opt_uvmhist.h
@@ -249,12 +249,8 @@ uvm_swap_init(void)
 	LIST_INIT(swap_priority);
 	uvmexp.nswapdev = 0;
 	rw_init(swap_syscall_lock);
-	cv_init(uvm.scheduler_cv, schedule);
 	mutex_init(uvm_swap_data_lock, MUTEX_DEFAULT, IPL_NONE);
 
-	/* XXXSMP should be at IPL_VM, but for audio interrupt handlers. */
-	mutex_init(uvm_scheduler_mutex, MUTEX_SPIN, IPL_SCHED);
-
 	if (bdevvp(swapdev, swapdev_vp))
 		panic(uvm_swap_init: can't get vnode for swap device);
 	if (vn_lock(swapdev_vp, LK_EXCLUSIVE | LK_RETRY))



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-04-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Apr  4 00:26:26 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_init.c uvm_swap.c

Log Message:
Move the uvm_scheduler_mutex and cv init to uvm_init since they are
independent of VMSWAP.


To generate a diff of this commit:
cvs rdiff -u -r1.34.12.1 -r1.34.12.2 src/sys/uvm/uvm_init.c
cvs rdiff -u -r1.140.4.1 -r1.140.4.1.4.1 src/sys/uvm/uvm_swap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 17 23:35:31 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Assert the page isn't free before munging with its pageq.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.3 -r1.12.16.4 src/sys/uvm/uvm_pdpolicy_clock.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/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.3 src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.4
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.3	Sun Feb 12 07:30:25 2012
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Fri Feb 17 23:35:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.3 2012/02/12 07:30:25 matt Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.4 2012/02/17 23:35:31 matt Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*
@@ -74,7 +74,7 @@
 #else /* defined(PDSIM) */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.3 2012/02/12 07:30:25 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.4 2012/02/17 23:35:31 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -328,6 +328,7 @@ uvmpdpol_pagedeactivate(struct vm_page *
 	struct uvm_pggroup * const grp = uvm_page_to_pggroup(pg);
 	struct uvmpdpol_groupstate * const gs = grp-pgrp_gs;
 
+	KASSERT(!(pg-pqflags  PQ_FREE));
 	KASSERT(mutex_owned(uvm_pageqlock));
 
 	//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
@@ -361,6 +362,9 @@ uvmpdpol_pageactivate(struct vm_page *pg
 	struct uvm_pggroup * const grp = uvm_page_to_pggroup(pg);
 	struct uvmpdpol_groupstate * const gs = grp-pgrp_gs;
 
+	KASSERT(!(pg-pqflags  PQ_FREE));
+	KASSERT(mutex_owned(uvm_pageqlock));
+
 	uvmpdpol_pagedequeue(pg);
 	TAILQ_INSERT_TAIL(gs-gs_activeq, pg, pageq.queue);
 	pg-pqflags |= PQ_ACTIVE;
@@ -376,6 +380,8 @@ uvmpdpol_pagedequeue(struct vm_page *pg)
 	struct uvm_pggroup * const grp = uvm_page_to_pggroup(pg);
 	struct uvmpdpol_groupstate * const gs = grp-pgrp_gs;
 
+	KASSERT(!(pg-pqflags  PQ_FREE));
+	KASSERT(mutex_owned(uvm_pageqlock));
 	//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
 
 	if (pg-pqflags  PQ_ACTIVE) {



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 17 23:36:04 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c

Log Message:
Change way waiters are handled.


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.6 -r1.93.4.2.4.7 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_pdaemon.c
diff -u src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.6 src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.7
--- src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.6	Thu Feb 16 04:20:45 2012
+++ src/sys/uvm/uvm_pdaemon.c	Fri Feb 17 23:36:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.6 2012/02/16 04:20:45 matt Exp $	*/
+/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.7 2012/02/17 23:36:04 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.6 2012/02/16 04:20:45 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.7 2012/02/17 23:36:04 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -170,6 +170,7 @@ uvm_wait(const char *wmsg)
 	uvm_pdinfo.pd_waiters++;
 	wakeup(uvm.pagedaemon);		/* wake the daemon! */
 	UVM_UNLOCK_AND_WAIT(uvmexp.free, uvm_fpageqlock, false, wmsg, timo);
+	uvm_pdinfo.pd_waiters--;
 }
 
 
@@ -372,12 +373,19 @@ uvm_pageout(void *arg)
 		 * active paging, then wait.
 		 */
 		if (pdinfo-pd_waiters == 0
-		|| TAILQ_FIRST(pdinfo-pd_pendingq) == NULL) {
+		 TAILQ_FIRST(pdinfo-pd_pendingq) == NULL) {
 			UVMHIST_LOG(pdhist,  SLEEPING,0,0,0,0);
 			UVM_UNLOCK_AND_WAIT(uvm.pagedaemon,
 			uvm_fpageqlock, false, pgdaemon, 0);
 			uvmexp.pdwoke++;
 			UVMHIST_LOG(pdhist,  WOKE UP,0,0,0,0);
+		} else if (TAILQ_FIRST(pdinfo-pd_pendingq) == NULL) {
+			/*
+			 * Someone is waiting but no group are pending.
+			 * Let's kick ourselves to find groups that need work.
+			 */
+			uvm_kick_pdaemon();
+			mutex_spin_exit(uvm_fpageqlock);
 		} else {
 			mutex_spin_exit(uvm_fpageqlock);
 		}
@@ -460,7 +468,6 @@ uvm_pageout(void *arg)
 
 		}
 		if (need_wakeup) {
-			pdinfo-pd_waiters = 0;
 			wakeup(uvmexp.free);
 		}
 		KASSERT (!need_free || need_wakeup);
@@ -569,7 +576,6 @@ uvm_pageout_done(struct vm_page *pg, boo
 	if (grp-pgrp_free * uvmexp.npggroups = uvmexp.reserve_kernel) {
 		wakeup(uvm.pagedaemon);
 	} else {
-		pdinfo-pd_waiters = 0;
 		wakeup(uvmexp.free);
 	}
 



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 17 23:35:31 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Assert the page isn't free before munging with its pageq.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.3 -r1.12.16.4 src/sys/uvm/uvm_pdpolicy_clock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 17 23:36:04 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdaemon.c

Log Message:
Change way waiters are handled.


To generate a diff of this commit:
cvs rdiff -u -r1.93.4.2.4.6 -r1.93.4.2.4.7 src/sys/uvm/uvm_pdaemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 04:20:46 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_anon.c uvm_page.c uvm_page.h
uvm_pdaemon.c uvm_pglist.h uvm_stat.c

Log Message:
Track the victims selected by the pagedaemon and what happens to then.
Keep a hint for what page group has the most free pages for a given color.


To generate a diff of this commit:
cvs rdiff -u -r1.51.28.1 -r1.51.28.2 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.140.6.3.4.8 -r1.140.6.3.4.9 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.55.14.7 -r1.55.14.8 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.93.4.2.4.5 -r1.93.4.2.4.6 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.7.16.4 -r1.7.16.5 src/sys/uvm/uvm_pglist.h
cvs rdiff -u -r1.31.12.2 -r1.31.12.3 src/sys/uvm/uvm_stat.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/uvm/uvm_anon.c
diff -u src/sys/uvm/uvm_anon.c:1.51.28.1 src/sys/uvm/uvm_anon.c:1.51.28.2
--- src/sys/uvm/uvm_anon.c:1.51.28.1	Tue Feb 14 01:12:42 2012
+++ src/sys/uvm/uvm_anon.c	Thu Feb 16 04:20:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_anon.c,v 1.51.28.1 2012/02/14 01:12:42 matt Exp $	*/
+/*	$NetBSD: uvm_anon.c,v 1.51.28.2 2012/02/16 04:20:45 matt Exp $	*/
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_anon.c,v 1.51.28.1 2012/02/14 01:12:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_anon.c,v 1.51.28.2 2012/02/16 04:20:45 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -192,7 +192,6 @@ uvm_anfree(struct vm_anon *anon)
 return;
 			}
 			mutex_enter(uvm_pageqlock);
-			uvm_pagedequeue(pg);
 			uvm_pagefree(pg);
 			mutex_exit(uvm_pageqlock);
 			mutex_exit(anon-an_lock);

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.8 src/sys/uvm/uvm_page.c:1.140.6.3.4.9
--- src/sys/uvm/uvm_page.c:1.140.6.3.4.8	Tue Feb 14 01:12:42 2012
+++ src/sys/uvm/uvm_page.c	Thu Feb 16 04:20:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.8 2012/02/14 01:12:42 matt Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.9 2012/02/16 04:20:45 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.8 2012/02/14 01:12:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.140.6.3.4.9 2012/02/16 04:20:45 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -321,12 +321,17 @@ uvm_pageremove(struct vm_page *pg)
 }
 
 static void
-uvm_page_init_freelist(struct pgfreelist *pgfl)
+uvm_page_init_freelist(struct pgfreelist *pgfl, struct uvm_pggroup *pggroups,
+	size_t color)
 {
 	for (size_t free_list = 0; free_list  VM_NFREELIST; free_list++) {
 		for (size_t queue = 0; queue  PGFL_NQUEUES; queue++) {
 			LIST_INIT(pgfl-pgfl_queues[free_list][queue]);
 		}
+		pgfl-pgfl_pggroups[free_list] =
+		pggroups[free_list * uvmexp.ncolors + color];
+		pgfl-pgfl_pggroups[free_list]-pgrp_free_list = free_list;
+		pgfl-pgfl_pggroups[free_list]-pgrp_color = color;
 	}
 	for (size_t queue = 0; queue  PGFL_NQUEUES; queue++) {
 		pgfl-pgfl_pages[queue] = 0;
@@ -435,8 +440,10 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr
 	KASSERT(pagearray != NULL);
 
 	for (u_int color = 0; color  uvmexp.ncolors; color++) {
-		uvm_page_init_freelist(uvm.page_free[color]);
-		uvm_page_init_freelist(uvm.cpus[0].page_free[color]);
+		uvm_page_init_freelist(uvm.page_free[color],
+		grparray, color);
+		uvm_page_init_freelist(uvm.cpus[0].page_free[color],
+		grparray, color);
 	}
 
 	memset(pagearray, 0, pagecount * sizeof(struct vm_page));
@@ -466,7 +473,7 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr
 			if (i = seg-avail_start  i  seg-avail_end) {
 size_t pggroup = VM_PAGE_TO_PGGROUP(pg, uvmexp.ncolors);
 uvmexp.npages++;
-
+
 KASSERT(pggroup  npggroup);
 if (grparray[pggroup].pgrp_npages++ == 0) {
 	uvmexp.npggroups++;
@@ -962,8 +969,8 @@ uvm_page_recolor(int newncolors)
 
 	ucpu = curcpu()-ci_data.cpu_uvm;
 	for (color = 0; color  newncolors; color++) {
-		uvm_page_init_freelist(uvmarray[color]);
-		uvm_page_init_freelist(cpuarray[color]);
+		uvm_page_init_freelist(uvmarray[color], grparray, color);
+		uvm_page_init_freelist(cpuarray[color], grparray, color);
 	}
 	old_gpgfl = olduvmarray;
 	old_pgfl = ucpu-page_free;
@@ -1082,7 +1089,8 @@ uvm_cpu_attach(struct cpu_info *ci)
 	ucpu-page_free = malloc(uvmexp.ncolors * sizeof(ucpu-page_free[0]),
 	M_VMPAGE, M_WAITOK);
 	for (size_t color = 0; color  uvmexp.ncolors; color++) {
-		uvm_page_init_freelist(ucpu-page_free[color]);
+		uvm_page_init_freelist(ucpu-page_free[color],
+		uvm.pggroups, color);
 	}
 	ci-ci_data.cpu_uvm = ucpu;
 }
@@ -1284,7 +1292,16 @@ uvm_pagealloc_strat(struct uvm_object *o
 
  again:
 	switch (strat) {
-	case UVM_PGA_STRAT_NORMAL:
+	case UVM_PGA_STRAT_NORMAL: {
+		struct uvm_pggroup *hint = 

CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 04:20:46 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_anon.c uvm_page.c uvm_page.h
uvm_pdaemon.c uvm_pglist.h uvm_stat.c

Log Message:
Track the victims selected by the pagedaemon and what happens to then.
Keep a hint for what page group has the most free pages for a given color.


To generate a diff of this commit:
cvs rdiff -u -r1.51.28.1 -r1.51.28.2 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.140.6.3.4.8 -r1.140.6.3.4.9 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.55.14.7 -r1.55.14.8 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.93.4.2.4.5 -r1.93.4.2.4.6 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.7.16.4 -r1.7.16.5 src/sys/uvm/uvm_pglist.h
cvs rdiff -u -r1.31.12.2 -r1.31.12.3 src/sys/uvm/uvm_stat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 13 23:07:31 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.h uvm_pdaemon.c

Log Message:
Use separate pending and paging tailq entries.
Add a queue check routine to validate the queues aren't corrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.55.14.6 -r1.55.14.7 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.93.4.2.4.3 -r1.93.4.2.4.4 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.55.14.6 src/sys/uvm/uvm_page.h:1.55.14.7
--- src/sys/uvm/uvm_page.h:1.55.14.6	Thu Feb  9 03:05:00 2012
+++ src/sys/uvm/uvm_page.h	Mon Feb 13 23:07:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.h,v 1.55.14.6 2012/02/09 03:05:00 matt Exp $	*/
+/*	$NetBSD: uvm_page.h,v 1.55.14.7 2012/02/13 23:07:31 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -248,7 +248,8 @@ struct vm_physseg {
  * Fields from uvmexp which need to be kept on a per-group basis.
  */
 struct uvm_pggroup {
-	TAILQ_ENTRY(uvm_pggroup) pgrp_pd_link;
+	TAILQ_ENTRY(uvm_pggroup) pgrp_pending_link;
+	TAILQ_ENTRY(uvm_pggroup) pgrp_paging_link;
 	STAILQ_ENTRY(uvm_pggroup) pgrp_uvm_link;
 
 	struct uvmpdpol_groupstate *pgrp_gs;	/* for pdpolicy */

Index: src/sys/uvm/uvm_pdaemon.c
diff -u src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.3 src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.4
--- src/sys/uvm/uvm_pdaemon.c:1.93.4.2.4.3	Thu Feb  9 03:05:01 2012
+++ src/sys/uvm/uvm_pdaemon.c	Mon Feb 13 23:07:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.3 2012/02/09 03:05:01 matt Exp $	*/
+/*	$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.4 2012/02/13 23:07:31 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.3 2012/02/09 03:05:01 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.4 2012/02/13 23:07:31 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -106,6 +106,8 @@ static void	uvmpd_scan(struct uvm_pggrou
 static void	uvmpd_scan_queue(struct uvm_pggroup *);
 static void	uvmpd_tune(void);
 
+static void	uvmpd_checkgroup(const struct uvm_pggroup *);
+
 static struct uvm_pdinfo {
 	unsigned int pd_waiters;
 	unsigned int pd_scans_neededs;
@@ -170,6 +172,40 @@ uvm_wait(const char *wmsg)
 	UVM_UNLOCK_AND_WAIT(uvmexp.free, uvm_fpageqlock, false, wmsg, timo);
 }
 
+
+static void
+uvmpd_checkgroup(const struct uvm_pggroup *grp)
+{
+#ifdef DEBUG
+	struct uvm_pdinfo * const pdinfo = uvm_pdinfo;
+	bool in_pendingq = false;
+	bool in_pagingq = false;
+	const struct uvm_pggroup *tstgrp;
+
+	TAILQ_FOREACH(tstgrp, pdinfo-pd_pendingq, pgrp_pending_link) {
+		if (tstgrp == grp) {
+			in_pendingq = true;
+			break;
+		}
+	}
+
+	TAILQ_FOREACH(tstgrp, pdinfo-pd_pagingq, pgrp_paging_link) {
+		if (tstgrp == grp) {
+			in_pagingq = true;
+			break;
+		}
+	}
+
+	if (grp-pgrp_paging  0) {
+		KASSERT(in_pagingq);
+		KASSERT(!in_pendingq);
+	} else {
+		KASSERT(!in_pagingq);
+		KASSERT(in_pendingq == grp-pgrp_scan_needed);
+	}
+#endif
+}
+
 /*
  * uvm_kick_pdaemon: perform checks to determine if we need to
  * give the pagedaemon a nudge, and do so if necessary.
@@ -191,6 +227,7 @@ uvm_kick_pdaemon(void)
 		const bool prev_scan_needed = grp-pgrp_scan_needed;
 
 		KASSERT(grp-pgrp_npages  0);
+		uvmpd_checkgroup(grp);
 
 		grp-pgrp_scan_needed =
 		grp-pgrp_free + grp-pgrp_paging  grp-pgrp_freemin
@@ -207,16 +244,16 @@ uvm_kick_pdaemon(void)
 			grp-pgrp_freemin, grp-pgrp_freetarg);
 		}
 
-		if (grp-pgrp_paging == 0
-		 prev_scan_needed != grp-pgrp_scan_needed) {
+		if (prev_scan_needed != grp-pgrp_scan_needed) {
 			if (grp-pgrp_scan_needed) {
 TAILQ_INSERT_TAIL(pdinfo-pd_pendingq,
-grp, pgrp_pd_link);
+grp, pgrp_pending_link);
 need_wakeup = true;
 			} else {
 TAILQ_REMOVE(pdinfo-pd_pendingq,
-grp, pgrp_pd_link);
+grp, pgrp_pending_link);
 			}
+			uvmpd_checkgroup(grp);
 		}
 	}
 
@@ -224,7 +261,7 @@ uvm_kick_pdaemon(void)
 		wakeup(uvm.pagedaemon);
 
 	UVMHIST_LOG(pdhist,  - done: wakeup=%d!,
-	grp - uvm.pggroups, need_wakeup, 0, 0);
+	need_wakeup, 0, 0, 0);
 }
 
 /*
@@ -371,6 +408,16 @@ uvm_pageout(void *arg)
 
 			uvmpdpol_tune(grp);
 
+			/*
+			 * While we are locked, remove this from the pendingq.
+			 */
+			uvmpd_checkgroup(grp);
+			KASSERT(grp-pgrp_scan_needed);
+			TAILQ_REMOVE(pdinfo-pd_pendingq, grp,
+			pgrp_pending_link);
+			grp-pgrp_scan_needed = false;
+			uvmpd_checkgroup(grp);
+
 			int diff = grp-pgrp_freetarg - grp-pgrp_free;
 			if (diff  0)
 diff = 0;
@@ -411,11 +458,6 @@ uvm_pageout(void *arg)
 need_wakeup = true;
 			}
 
-			/*
-			 * We are done, remove it from the queue.
-			 */
-			TAILQ_REMOVE(pdinfo-pd_pendingq, grp, pgrp_pd_link);
-			

CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Feb 14 01:12:43 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_anon.c uvm_km.c uvm_page.c
uvm_pager.c uvm_pdaemon.c uvm_pglist.c

Log Message:
Add more KASSERTs (more! more! more!).
When returning page to the free pool, make sure to dequeue the pages before
hand or free page queue corruption will happen.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.51.28.1 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.101.4.2.4.7 -r1.101.4.2.4.8 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.140.6.3.4.7 -r1.140.6.3.4.8 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.92.18.4 -r1.92.18.5 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.93.4.2.4.4 -r1.93.4.2.4.5 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.42.16.11 -r1.42.16.12 src/sys/uvm/uvm_pglist.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/uvm/uvm_anon.c
diff -u src/sys/uvm/uvm_anon.c:1.51 src/sys/uvm/uvm_anon.c:1.51.28.1
--- src/sys/uvm/uvm_anon.c:1.51	Fri Jan 18 10:48:23 2008
+++ src/sys/uvm/uvm_anon.c	Tue Feb 14 01:12:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_anon.c,v 1.51 2008/01/18 10:48:23 yamt Exp $	*/
+/*	$NetBSD: uvm_anon.c,v 1.51.28.1 2012/02/14 01:12:42 matt Exp $	*/
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_anon.c,v 1.51 2008/01/18 10:48:23 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_anon.c,v 1.51.28.1 2012/02/14 01:12:42 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -192,6 +192,7 @@ uvm_anfree(struct vm_anon *anon)
 return;
 			}
 			mutex_enter(uvm_pageqlock);
+			uvm_pagedequeue(pg);
 			uvm_pagefree(pg);
 			mutex_exit(uvm_pageqlock);
 			mutex_exit(anon-an_lock);

Index: src/sys/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.101.4.2.4.7 src/sys/uvm/uvm_km.c:1.101.4.2.4.8
--- src/sys/uvm/uvm_km.c:1.101.4.2.4.7	Fri Feb 10 07:14:00 2012
+++ src/sys/uvm/uvm_km.c	Tue Feb 14 01:12:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.7 2012/02/10 07:14:00 matt Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.8 2012/02/14 01:12:42 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.7 2012/02/10 07:14:00 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.101.4.2.4.8 2012/02/14 01:12:42 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -437,6 +437,7 @@ uvm_km_pgremove(vaddr_t startva, vaddr_t
 		uao_dropswap(uobj, curoff  PAGE_SHIFT);
 		if (pg != NULL) {
 			mutex_enter(uvm_pageqlock);
+			uvm_pagedequeue(pg);
 			uvm_pagefree(pg);
 			mutex_exit(uvm_pageqlock);
 		}

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.7 src/sys/uvm/uvm_page.c:1.140.6.3.4.8
--- src/sys/uvm/uvm_page.c:1.140.6.3.4.7	Thu Feb  9 03:05:00 2012
+++ src/sys/uvm/uvm_page.c	Tue Feb 14 01:12:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.7 2012/02/09 03:05:00 matt Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.8 2012/02/14 01:12:42 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.7 2012/02/09 03:05:00 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.140.6.3.4.8 2012/02/14 01:12:42 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -1109,6 +1109,7 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu,
 		/* cpu, try1 */
 		struct pgflist * const freeq = pgfl-pgfl_queues[free_list];
 		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]);
 			ucpu-page_cpuhit++;
@@ -1118,7 +1119,11 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu,
 		/* global, try1 */
 		struct pgflist * const gfreeq = gpgfl-pgfl_queues[free_list];
 		if ((pg = LIST_FIRST(gfreeq[try1])) != NULL) {
+			KASSERT(pg-pqflags  PQ_FREE);
 			ucpu = VM_FREE_PAGE_TO_CPU(pg);
+#ifndef MULTIPROCESSOR
+			KASSERT(ucpu == uvm.cpus);
+#endif
 			pgfl = ucpu-page_free[color];
 			ucpu-page_cpumiss++;
 			goto gotit;
@@ -1126,6 +1131,7 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu,
 
 		/* cpu, try2 */
 		if ((pg = LIST_FIRST(freeq[try2])) != NULL) {
+			KASSERT(pg-pqflags  PQ_FREE);
 			KASSERT(ucpu == VM_FREE_PAGE_TO_CPU(pg));
 			KASSERT(pgfl == ucpu-page_free[color]);
 			ucpu-page_cpuhit++;
@@ -1135,7 +1141,11 @@ uvm_pagealloc_pgfl(struct uvm_cpu *ucpu,
 
 		/* global, try2 */
 		if ((pg = LIST_FIRST(gfreeq[try2])) != NULL) {
+			KASSERT(pg-pqflags  PQ_FREE);
 			ucpu = VM_FREE_PAGE_TO_CPU(pg);
+#ifndef MULTIPROCESSOR
+			KASSERT(ucpu == uvm.cpus);
+#endif
 			pgfl = ucpu-page_free[color];
 			ucpu-page_cpumiss++;
 			try1 = try2;
@@ -1503,6 +1513,7 @@ uvm_pagefree(struct vm_page *pg)
 	}
 #endif /* DEBUG */
 
+	KASSERT(!uvmpdpol_pageisqueued_p(pg));
 	KASSERT((pg-flags  

CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 13 23:07:31 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.h uvm_pdaemon.c

Log Message:
Use separate pending and paging tailq entries.
Add a queue check routine to validate the queues aren't corrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.55.14.6 -r1.55.14.7 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.93.4.2.4.3 -r1.93.4.2.4.4 src/sys/uvm/uvm_pdaemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Feb 14 01:12:43 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_anon.c uvm_km.c uvm_page.c
uvm_pager.c uvm_pdaemon.c uvm_pglist.c

Log Message:
Add more KASSERTs (more! more! more!).
When returning page to the free pool, make sure to dequeue the pages before
hand or free page queue corruption will happen.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.51.28.1 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.101.4.2.4.7 -r1.101.4.2.4.8 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.140.6.3.4.7 -r1.140.6.3.4.8 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.92.18.4 -r1.92.18.5 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.93.4.2.4.4 -r1.93.4.2.4.5 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.42.16.11 -r1.42.16.12 src/sys/uvm/uvm_pglist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Feb 12 07:30:25 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Disable some of more agressive debug checks since with lots of pages, they
cause O(n^2) increases in time.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.2 -r1.12.16.3 src/sys/uvm/uvm_pdpolicy_clock.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/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.2 src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.3
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.2	Thu Feb  9 03:05:01 2012
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Sun Feb 12 07:30:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.2 2012/02/09 03:05:01 matt Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.3 2012/02/12 07:30:25 matt Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*
@@ -74,7 +74,7 @@
 #else /* defined(PDSIM) */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.2 2012/02/09 03:05:01 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.3 2012/02/12 07:30:25 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -208,7 +208,7 @@ uvmpdpol_selectvictim(struct uvm_pggroup
 		struct vm_anon *anon;
 		struct uvm_object *uobj;
 
-		KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
+		//KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
 
 		if (ss-ss_first) {
 			pg = TAILQ_FIRST(gs-gs_inactiveq);
@@ -287,7 +287,7 @@ uvmpdpol_balancequeue(struct uvm_pggroup
 	 * our inactive target.
 	 */
 
-	KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
+	//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
 
 	u_int inactive_shortage = gs-gs_inactarg - gs-gs_inactive;
 	for (pg = TAILQ_FIRST(gs-gs_activeq);
@@ -319,7 +319,7 @@ uvmpdpol_balancequeue(struct uvm_pggroup
 		}
 	}
 
-	KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
+	//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
 }
 
 void
@@ -330,7 +330,7 @@ uvmpdpol_pagedeactivate(struct vm_page *
 
 	KASSERT(mutex_owned(uvm_pageqlock));
 
-	KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
+	//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
 
 	if (pg-pqflags  PQ_ACTIVE) {
 		TAILQ_REMOVE(gs-gs_activeq, pg, pageq.queue);
@@ -340,8 +340,8 @@ uvmpdpol_pagedeactivate(struct vm_page *
 		grp-pgrp_active--;
 	}
 
-	KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
-	KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
+	//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
+	//KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
 
 	if ((pg-pqflags  PQ_INACTIVE) == 0) {
 		KASSERT(pg-wire_count == 0);
@@ -352,7 +352,7 @@ uvmpdpol_pagedeactivate(struct vm_page *
 		grp-pgrp_inactive++;
 	}
 
-	KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
+	//KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
 }
 
 void
@@ -367,7 +367,7 @@ uvmpdpol_pageactivate(struct vm_page *pg
 	gs-gs_active++;
 	grp-pgrp_active++;
 
-	KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
+	//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
 }
 
 void
@@ -376,7 +376,7 @@ uvmpdpol_pagedequeue(struct vm_page *pg)
 	struct uvm_pggroup * const grp = uvm_page_to_pggroup(pg);
 	struct uvmpdpol_groupstate * const gs = grp-pgrp_gs;
 
-	KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
+	//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
 
 	if (pg-pqflags  PQ_ACTIVE) {
 		KASSERT(mutex_owned(uvm_pageqlock));
@@ -387,8 +387,8 @@ uvmpdpol_pagedequeue(struct vm_page *pg)
 		grp-pgrp_active--;
 	}
 
-	KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
-	KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
+	//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
+	//KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
 
 	if (pg-pqflags  PQ_INACTIVE) {
 		KASSERT(mutex_owned(uvm_pageqlock));
@@ -399,7 +399,7 @@ uvmpdpol_pagedequeue(struct vm_page *pg)
 		grp-pgrp_inactive--;
 	}
 
-	KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
+	//KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
 }
 
 void
@@ -430,8 +430,8 @@ uvmpdpol_estimatepageable(u_int *activep
 	STAILQ_FOREACH(grp, uvm.page_groups, pgrp_uvm_link) {
 		struct uvmpdpol_groupstate * const gs = grp-pgrp_gs;
 
-		KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
-		KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
+		//KDASSERT(gs-gs_active == clock_pglist_count(gs-gs_activeq));
+		//KDASSERT(gs-gs_inactive == clock_pglist_count(gs-gs_inactiveq));
 
 		active += gs-gs_active;
 		inactive += gs-gs_inactive;



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Feb 12 07:30:25 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Disable some of more agressive debug checks since with lots of pages, they
cause O(n^2) increases in time.


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.2 -r1.12.16.3 src/sys/uvm/uvm_pdpolicy_clock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 07:14:01 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_km.c

Log Message:
Place allocated kmem pages on a kmem_pageq.  This makes it easy for crash
dump code to find them.


To generate a diff of this commit:
cvs rdiff -u -r1.101.4.2.4.6 -r1.101.4.2.4.7 src/sys/uvm/uvm_km.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/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.101.4.2.4.6 src/sys/uvm/uvm_km.c:1.101.4.2.4.7
--- src/sys/uvm/uvm_km.c:1.101.4.2.4.6	Thu Feb  9 03:04:59 2012
+++ src/sys/uvm/uvm_km.c	Fri Feb 10 07:14:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.6 2012/02/09 03:04:59 matt Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.7 2012/02/10 07:14:00 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.6 2012/02/09 03:04:59 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.101.4.2.4.7 2012/02/10 07:14:00 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -815,14 +815,16 @@ uvm_km_free_poolpage(struct vm_map *map,
 void
 uvm_km_pageclaim(struct vm_page *pg)
 {
+	KASSERT(!(pg-pqflags  (PQ_PRIVATE1|PQ_PRIVATE2)));
 	atomic_inc_uint(uvm_page_to_pggroup(pg)-pgrp_kmempages);
-//	TAILQ_INSERT_TAIL(uvm.kmem_pageq, pg, listq.queue);
+	TAILQ_INSERT_TAIL(uvm.kmem_pageq, pg, pageq.queue);
 }
 
 void
 uvm_km_pagefree(struct vm_page *pg)
 {
+	KASSERT(!(pg-pqflags  (PQ_PRIVATE1|PQ_PRIVATE2)));
 	atomic_dec_uint(uvm_page_to_pggroup(pg)-pgrp_kmempages);
-//	TAILQ_REMOVE(uvm.kmem_pageq, pg, listq.queue);
+	TAILQ_REMOVE(uvm.kmem_pageq, pg, pageq.queue);
 	uvm_pagefree(pg);
 }



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 07:14:01 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_km.c

Log Message:
Place allocated kmem pages on a kmem_pageq.  This makes it easy for crash
dump code to find them.


To generate a diff of this commit:
cvs rdiff -u -r1.101.4.2.4.6 -r1.101.4.2.4.7 src/sys/uvm/uvm_km.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:05:02 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm.h uvm_amap.c uvm_extern.h uvm_init.c
uvm_km.c uvm_map.c uvm_meter.c uvm_page.c uvm_page.h uvm_pager.c
uvm_pdaemon.c uvm_pdpolicy.h uvm_pdpolicy_clock.c
uvm_pdpolicy_clockpro.c uvm_pglist.c uvm_pglist.h uvm_stat.c

Log Message:
Major changes to uvm.
Support multiple collections (groups) of free pages and run the page
reclaimation algorithm on each group independently.


To generate a diff of this commit:
cvs rdiff -u -r1.55.16.2 -r1.55.16.3 src/sys/uvm/uvm.h
cvs rdiff -u -r1.84.20.1 -r1.84.20.1.4.1 src/sys/uvm/uvm_amap.c
cvs rdiff -u -r1.148.4.2.4.4 -r1.148.4.2.4.5 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.34 -r1.34.12.1 src/sys/uvm/uvm_init.c
cvs rdiff -u -r1.101.4.2.4.5 -r1.101.4.2.4.6 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.263.4.3.4.6 -r1.263.4.3.4.7 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.49.16.2 -r1.49.16.3 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.140.6.3.4.6 -r1.140.6.3.4.7 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.55.14.5 -r1.55.14.6 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.92.18.3 -r1.92.18.4 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.93.4.2.4.2 -r1.93.4.2.4.3 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.3 -r1.3.62.1 src/sys/uvm/uvm_pdpolicy.h
cvs rdiff -u -r1.12.16.1 -r1.12.16.2 src/sys/uvm/uvm_pdpolicy_clock.c
cvs rdiff -u -r1.15 -r1.15.16.1 src/sys/uvm/uvm_pdpolicy_clockpro.c
cvs rdiff -u -r1.42.16.10 -r1.42.16.11 src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.7.16.3 -r1.7.16.4 src/sys/uvm/uvm_pglist.h
cvs rdiff -u -r1.31.12.1 -r1.31.12.2 src/sys/uvm/uvm_stat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-01-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 21 23:20:58 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Use pg instead p as a pointer to struct uvm_page.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.16.1 src/sys/uvm/uvm_pdpolicy_clock.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/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.12 src/sys/uvm/uvm_pdpolicy_clock.c:1.12.16.1
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.12	Wed Jun  4 12:41:40 2008
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Sat Jan 21 23:20:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12 2008/06/04 12:41:40 ad Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.1 2012/01/21 23:20:58 matt Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*
@@ -74,7 +74,7 @@
 #else /* defined(PDSIM) */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12 2008/06/04 12:41:40 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.1 2012/01/21 23:20:58 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -246,7 +246,7 @@ void
 uvmpdpol_balancequeue(int swap_shortage)
 {
 	int inactive_shortage;
-	struct vm_page *p, *nextpg;
+	struct vm_page *pg, *nextpg;
 
 	/*
 	 * we have done the scan to get free pages.   now we work on meeting
@@ -254,17 +254,17 @@ uvmpdpol_balancequeue(int swap_shortage)
 	 */
 
 	inactive_shortage = pdpol_state.s_inactarg - pdpol_state.s_inactive;
-	for (p = TAILQ_FIRST(pdpol_state.s_activeq);
-	 p != NULL  (inactive_shortage  0 || swap_shortage  0);
-	 p = nextpg) {
-		nextpg = TAILQ_NEXT(p, pageq.queue);
+	for (pg = TAILQ_FIRST(pdpol_state.s_activeq);
+	 pg != NULL  (inactive_shortage  0 || swap_shortage  0);
+	 pg = nextpg) {
+		nextpg = TAILQ_NEXT(pg, pageq.queue);
 
 		/*
 		 * if there's a shortage of swap slots, try to free it.
 		 */
 
-		if (swap_shortage  0  (p-pqflags  PQ_SWAPBACKED) != 0) {
-			if (uvmpd_trydropswap(p)) {
+		if (swap_shortage  0  (pg-pqflags  PQ_SWAPBACKED) != 0) {
+			if (uvmpd_trydropswap(pg)) {
 swap_shortage--;
 			}
 		}
@@ -275,7 +275,7 @@ uvmpdpol_balancequeue(int swap_shortage)
 
 		if (inactive_shortage  0) {
 			/* no need to check wire_count as pg is active */
-			uvmpdpol_pagedeactivate(p);
+			uvmpdpol_pagedeactivate(pg);
 			uvmexp.pddeact++;
 			inactive_shortage--;
 		}



CVS commit: [matt-nb5-mips64] src/sys/uvm

2012-01-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 21 23:20:58 UTC 2012

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pdpolicy_clock.c

Log Message:
Use pg instead p as a pointer to struct uvm_page.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.16.1 src/sys/uvm/uvm_pdpolicy_clock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov 29 07:44:52 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_param.h

Log Message:
Redefine ptoa() to be the inverse of atop.  If you were using a 32-bit vaddr_t
with 64-bit paddr_t and using managed addresses  4GB, uvm_page_init would
silently discard the upper 32-bits of the physical address possibly double
mapping pages.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.78.1 src/sys/uvm/uvm_param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_param.h
diff -u src/sys/uvm/uvm_param.h:1.21 src/sys/uvm/uvm_param.h:1.21.78.1
--- src/sys/uvm/uvm_param.h:1.21	Fri Aug  4 22:42:36 2006
+++ src/sys/uvm/uvm_param.h	Tue Nov 29 07:44:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_param.h,v 1.21 2006/08/04 22:42:36 he Exp $	*/
+/*	$NetBSD: uvm_param.h,v 1.21.78.1 2011/11/29 07:44:52 matt Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -196,7 +196,7 @@
  */
 #ifdef _KERNEL
 #define	atop(x)		(((paddr_t)(x))  PAGE_SHIFT)
-#define	ptoa(x)		((vaddr_t)((vaddr_t)(x)  PAGE_SHIFT))
+#define	ptoa(x)		(((paddr_t)(x))  PAGE_SHIFT)
 
 /*
  * Round off or truncate to the nearest page.  These will work



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov 29 07:45:58 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.c

Log Message:
Add a macro to allow a port to control from which freelists normal pages
can be allocated.


To generate a diff of this commit:
cvs rdiff -u -r1.140.6.3.4.5 -r1.140.6.3.4.6 src/sys/uvm/uvm_page.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/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.5 src/sys/uvm/uvm_page.c:1.140.6.3.4.6
--- src/sys/uvm/uvm_page.c:1.140.6.3.4.5	Fri Jun  3 07:59:58 2011
+++ src/sys/uvm/uvm_page.c	Tue Nov 29 07:45:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.5 2011/06/03 07:59:58 matt Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.6 2011/11/29 07:45:57 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.5 2011/06/03 07:59:58 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.140.6.3.4.6 2011/11/29 07:45:57 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -1166,6 +1166,14 @@ uvm_pagealloc_strat(struct uvm_object *o
 	case UVM_PGA_STRAT_NORMAL:
 		/* 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
 			pg = uvm_pagealloc_pgfl(ucpu, lcv,
 			try1, try2, color, anycolor);
 			if (pg != NULL)



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov 29 07:44:52 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_param.h

Log Message:
Redefine ptoa() to be the inverse of atop.  If you were using a 32-bit vaddr_t
with 64-bit paddr_t and using managed addresses  4GB, uvm_page_init would
silently discard the upper 32-bits of the physical address possibly double
mapping pages.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.78.1 src/sys/uvm/uvm_param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov 29 07:45:58 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.c

Log Message:
Add a macro to allow a port to control from which freelists normal pages
can be allocated.


To generate a diff of this commit:
cvs rdiff -u -r1.140.6.3.4.5 -r1.140.6.3.4.6 src/sys/uvm/uvm_page.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-11-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Nov  4 15:32:27 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.h

Log Message:
#include machine/vmparam.h if VM_NFREELIST isn't defined.


To generate a diff of this commit:
cvs rdiff -u -r1.7.16.2 -r1.7.16.3 src/sys/uvm/uvm_pglist.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_pglist.h
diff -u src/sys/uvm/uvm_pglist.h:1.7.16.2 src/sys/uvm/uvm_pglist.h:1.7.16.3
--- src/sys/uvm/uvm_pglist.h:1.7.16.2	Fri Jun  3 07:56:08 2011
+++ src/sys/uvm/uvm_pglist.h	Fri Nov  4 15:32:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.h,v 1.7.16.2 2011/06/03 07:56:08 matt Exp $	*/
+/*	$NetBSD: uvm_pglist.h,v 1.7.16.3 2011/11/04 15:32:27 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -32,6 +32,10 @@
 #ifndef _UVM_UVM_PGLIST_H_
 #define _UVM_UVM_PGLIST_H_
 
+#ifndef VM_NFREELIST
+#include machine/vmparam.h
+#endif
+
 /*
  * This defines the type of a page queue, e.g. active list, inactive
  * list, etc.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-11-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Nov  4 15:32:27 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.h

Log Message:
#include machine/vmparam.h if VM_NFREELIST isn't defined.


To generate a diff of this commit:
cvs rdiff -u -r1.7.16.2 -r1.7.16.3 src/sys/uvm/uvm_pglist.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 07:52:48 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_vnode.c

Log Message:
Restore $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.90.28.2 -r1.90.28.3 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/uvm/uvm_vnode.c
diff -u src/sys/uvm/uvm_vnode.c:1.90.28.2 src/sys/uvm/uvm_vnode.c:1.90.28.3
--- src/sys/uvm/uvm_vnode.c:1.90.28.2	Fri Jun  3 02:43:42 2011
+++ src/sys/uvm/uvm_vnode.c	Fri Jun  3 07:52:48 2011
@@ -1,4 +1,4 @@
-/*	uvm_vnode.c,v 1.90 2008/01/02 11:49:21 ad Exp	*/
+/*	$NetBSD: uvm_vnode.c,v 1.90.28.3 2011/06/03 07:52:48 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -50,7 +50,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, uvm_vnode.c,v 1.90 2008/01/02 11:49:21 ad Exp);
+__KERNEL_RCSID(0, $NetBSD: uvm_vnode.c,v 1.90.28.3 2011/06/03 07:52:48 matt Exp $);
 
 #include fs_nfs.h
 #include opt_uvmhist.h



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 07:56:08 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm.h uvm_extern.h uvm_page.h
uvm_pglist.h

Log Message:
Restore $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.55.16.1 -r1.55.16.2 src/sys/uvm/uvm.h
cvs rdiff -u -r1.148.4.2.4.3 -r1.148.4.2.4.4 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.55.14.4 -r1.55.14.5 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.7.16.1 -r1.7.16.2 src/sys/uvm/uvm_pglist.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm.h
diff -u src/sys/uvm/uvm.h:1.55.16.1 src/sys/uvm/uvm.h:1.55.16.2
--- src/sys/uvm/uvm.h:1.55.16.1	Fri Jun  3 02:43:41 2011
+++ src/sys/uvm/uvm.h	Fri Jun  3 07:56:08 2011
@@ -1,4 +1,4 @@
-/*	uvm.h,v 1.55 2008/06/04 15:06:04 ad Exp	*/
+/*	$NetBSD: uvm.h,v 1.55.16.2 2011/06/03 07:56:08 matt Exp $	*/
 
 /*
  *

Index: src/sys/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.148.4.2.4.3 src/sys/uvm/uvm_extern.h:1.148.4.2.4.4
--- src/sys/uvm/uvm_extern.h:1.148.4.2.4.3	Fri Jun  3 02:43:41 2011
+++ src/sys/uvm/uvm_extern.h	Fri Jun  3 07:56:08 2011
@@ -1,4 +1,4 @@
-/*	uvm_extern.h,v 1.148.4.2.4.1 2010/01/26 21:26:28 matt Exp	*/
+/*	$NetBSD: uvm_extern.h,v 1.148.4.2.4.4 2011/06/03 07:56:08 matt Exp $	*/
 
 /*
  *

Index: src/sys/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.55.14.4 src/sys/uvm/uvm_page.h:1.55.14.5
--- src/sys/uvm/uvm_page.h:1.55.14.4	Fri Jun  3 02:43:42 2011
+++ src/sys/uvm/uvm_page.h	Fri Jun  3 07:56:08 2011
@@ -1,4 +1,4 @@
-/*	uvm_page.h,v 1.55.14.2 2011/04/29 08:16:42 matt Exp	*/
+/*	$NetBSD: uvm_page.h,v 1.55.14.5 2011/06/03 07:56:08 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.

Index: src/sys/uvm/uvm_pglist.h
diff -u src/sys/uvm/uvm_pglist.h:1.7.16.1 src/sys/uvm/uvm_pglist.h:1.7.16.2
--- src/sys/uvm/uvm_pglist.h:1.7.16.1	Fri Jun  3 02:43:42 2011
+++ src/sys/uvm/uvm_pglist.h	Fri Jun  3 07:56:08 2011
@@ -1,4 +1,4 @@
-/*	uvm_pglist.h,v 1.7 2008/06/04 12:45:28 ad Exp	*/
+/*	$NetBSD: uvm_pglist.h,v 1.7.16.2 2011/06/03 07:56:08 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001, 2008 The NetBSD Foundation, Inc.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 07:59:59 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_aobj.c uvm_fault.c uvm_km.c
uvm_map.c uvm_meter.c uvm_page.c uvm_pager.c uvm_pdaemon.c

Log Message:
Restore $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.104.10.1 -r1.104.10.2 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.125.6.1.4.2 -r1.125.6.1.4.3 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.101.4.2.4.4 -r1.101.4.2.4.5 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.263.4.3.4.5 -r1.263.4.3.4.6 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.49.16.1 -r1.49.16.2 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.140.6.3.4.4 -r1.140.6.3.4.5 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.92.18.2 -r1.92.18.3 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.93.4.2.4.1 -r1.93.4.2.4.2 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_aobj.c
diff -u src/sys/uvm/uvm_aobj.c:1.104.10.1 src/sys/uvm/uvm_aobj.c:1.104.10.2
--- src/sys/uvm/uvm_aobj.c:1.104.10.1	Wed May 25 23:58:49 2011
+++ src/sys/uvm/uvm_aobj.c	Fri Jun  3 07:59:57 2011
@@ -1,4 +1,4 @@
-/*	uvm_aobj.c,v 1.104 2008/10/18 03:46:22 rmind Exp	*/
+/*	$NetBSD: uvm_aobj.c,v 1.104.10.2 2011/06/03 07:59:57 matt Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -43,7 +43,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, uvm_aobj.c,v 1.104 2008/10/18 03:46:22 rmind Exp);
+__KERNEL_RCSID(0, $NetBSD: uvm_aobj.c,v 1.104.10.2 2011/06/03 07:59:57 matt Exp $);
 
 #include opt_uvmhist.h
 

Index: src/sys/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.125.6.1.4.2 src/sys/uvm/uvm_fault.c:1.125.6.1.4.3
--- src/sys/uvm/uvm_fault.c:1.125.6.1.4.2	Wed May 25 23:58:49 2011
+++ src/sys/uvm/uvm_fault.c	Fri Jun  3 07:59:57 2011
@@ -1,4 +1,4 @@
-/*	uvm_fault.c,v 1.125.6.1.4.1 2010/01/26 21:26:28 matt Exp	*/
+/*	$NetBSD: uvm_fault.c,v 1.125.6.1.4.3 2011/06/03 07:59:57 matt Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, uvm_fault.c,v 1.125.6.1.4.1 2010/01/26 21:26:28 matt Exp);
+__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.125.6.1.4.3 2011/06/03 07:59:57 matt Exp $);
 
 #include opt_uvmhist.h
 

Index: src/sys/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.101.4.2.4.4 src/sys/uvm/uvm_km.c:1.101.4.2.4.5
--- src/sys/uvm/uvm_km.c:1.101.4.2.4.4	Wed May 25 23:58:50 2011
+++ src/sys/uvm/uvm_km.c	Fri Jun  3 07:59:58 2011
@@ -1,4 +1,4 @@
-/*	uvm_km.c,v 1.101.4.2.4.3 2010/02/06 05:28:30 matt Exp	*/
+/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.5 2011/06/03 07:59:58 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -128,7 +128,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, uvm_km.c,v 1.101.4.2.4.3 2010/02/06 05:28:30 matt Exp);
+__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.101.4.2.4.5 2011/06/03 07:59:58 matt Exp $);
 
 #include opt_uvmhist.h
 

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.263.4.3.4.5 src/sys/uvm/uvm_map.c:1.263.4.3.4.6
--- src/sys/uvm/uvm_map.c:1.263.4.3.4.5	Fri Jun  3 02:43:41 2011
+++ src/sys/uvm/uvm_map.c	Fri Jun  3 07:59:58 2011
@@ -1,4 +1,4 @@
-/*	uvm_map.c,v 1.263.4.3.4.3 2010/08/19 07:30:31 matt Exp	*/
+/*	$NetBSD: uvm_map.c,v 1.263.4.3.4.6 2011/06/03 07:59:58 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, uvm_map.c,v 1.263.4.3.4.3 2010/08/19 07:30:31 matt Exp);
+__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.263.4.3.4.6 2011/06/03 07:59:58 matt Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h

Index: src/sys/uvm/uvm_meter.c
diff -u src/sys/uvm/uvm_meter.c:1.49.16.1 src/sys/uvm/uvm_meter.c:1.49.16.2
--- src/sys/uvm/uvm_meter.c:1.49.16.1	Fri Jun  3 02:43:41 2011
+++ src/sys/uvm/uvm_meter.c	Fri Jun  3 07:59:58 2011
@@ -1,4 +1,4 @@
-/*	uvm_meter.c,v 1.49 2008/06/04 12:45:28 ad Exp	*/
+/*	$NetBSD: uvm_meter.c,v 1.49.16.2 2011/06/03 07:59:58 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, uvm_meter.c,v 1.49 2008/06/04 12:45:28 ad Exp);
+__KERNEL_RCSID(0, $NetBSD: uvm_meter.c,v 1.49.16.2 2011/06/03 07:59:58 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.4 src/sys/uvm/uvm_page.c:1.140.6.3.4.5
--- src/sys/uvm/uvm_page.c:1.140.6.3.4.4	Fri Jun  3 02:43:41 2011
+++ src/sys/uvm/uvm_page.c	Fri Jun  3 07:59:58 2011
@@ -1,4 +1,4 @@
-/*	uvm_page.c,v 1.140.6.3.4.3 2010/01/27 07:45:19 nisimura Exp	*/
+/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.5 2011/06/03 07:59:58 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, uvm_page.c,v 1.140.6.3.4.3 2010/01/27 07:45:19 nisimura Exp);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.140.6.3.4.5 2011/06/03 

CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 08:00:52 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Restore $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.42.16.9 -r1.42.16.10 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.42.16.9 src/sys/uvm/uvm_pglist.c:1.42.16.10
--- src/sys/uvm/uvm_pglist.c:1.42.16.9	Fri Jun  3 02:43:42 2011
+++ src/sys/uvm/uvm_pglist.c	Fri Jun  3 08:00:51 2011
@@ -1,4 +1,4 @@
-/*	uvm_pglist.c,v 1.42.16.6 2010/06/01 19:04:02 matt Exp	*/
+/*	$NetBSD: uvm_pglist.c,v 1.42.16.10 2011/06/03 08:00:51 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, uvm_pglist.c,v 1.42.16.6 2010/06/01 19:04:02 matt Exp);
+__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.42.16.10 2011/06/03 08:00:51 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 07:52:48 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_vnode.c

Log Message:
Restore $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.90.28.2 -r1.90.28.3 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.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 07:56:08 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm.h uvm_extern.h uvm_page.h
uvm_pglist.h

Log Message:
Restore $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.55.16.1 -r1.55.16.2 src/sys/uvm/uvm.h
cvs rdiff -u -r1.148.4.2.4.3 -r1.148.4.2.4.4 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.55.14.4 -r1.55.14.5 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.7.16.1 -r1.7.16.2 src/sys/uvm/uvm_pglist.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 07:59:59 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_aobj.c uvm_fault.c uvm_km.c
uvm_map.c uvm_meter.c uvm_page.c uvm_pager.c uvm_pdaemon.c

Log Message:
Restore $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.104.10.1 -r1.104.10.2 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.125.6.1.4.2 -r1.125.6.1.4.3 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.101.4.2.4.4 -r1.101.4.2.4.5 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.263.4.3.4.5 -r1.263.4.3.4.6 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.49.16.1 -r1.49.16.2 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.140.6.3.4.4 -r1.140.6.3.4.5 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.92.18.2 -r1.92.18.3 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.93.4.2.4.1 -r1.93.4.2.4.2 src/sys/uvm/uvm_pdaemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 08:00:52 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Restore $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.42.16.9 -r1.42.16.10 src/sys/uvm/uvm_pglist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-02 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 02:43:43 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm.h uvm_extern.h uvm_map.c uvm_meter.c
uvm_page.c uvm_page.h uvm_pager.c uvm_pdaemon.c uvm_pglist.c
uvm_pglist.h uvm_vnode.c

Log Message:
Rework page free lists to be sorted by color first rather than free_list.
Kept per color PGFL_* counter in each page free list.
Minor cleanups.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.16.1 src/sys/uvm/uvm.h
cvs rdiff -u -r1.148.4.2.4.2 -r1.148.4.2.4.3 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.263.4.3.4.4 -r1.263.4.3.4.5 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.49 -r1.49.16.1 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.140.6.3.4.3 -r1.140.6.3.4.4 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.55.14.3 -r1.55.14.4 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.92.18.1 -r1.92.18.2 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.93.4.2 -r1.93.4.2.4.1 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.42.16.8 -r1.42.16.9 src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.7 -r1.7.16.1 src/sys/uvm/uvm_pglist.h
cvs rdiff -u -r1.90.28.1 -r1.90.28.2 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/uvm/uvm.h
diff -u src/sys/uvm/uvm.h:1.55 src/sys/uvm/uvm.h:1.55.16.1
--- src/sys/uvm/uvm.h:1.55	Wed Jun  4 15:06:04 2008
+++ src/sys/uvm/uvm.h	Fri Jun  3 02:43:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm.h,v 1.55 2008/06/04 15:06:04 ad Exp $	*/
+/*	uvm.h,v 1.55 2008/06/04 15:06:04 ad Exp	*/
 
 /*
  *
@@ -78,7 +78,7 @@
  */
 
 struct uvm_cpu {
-	struct pgfreelist page_free[VM_NFREELIST]; /* unallocated pages */
+	struct pgfreelist *page_free;	/* unallocated pages */
 	int page_free_nextcolor;	/* next color to allocate from */
 	int page_idlezero_next;		/* which color to zero next */
 	bool page_idle_zero;		/* TRUE if we should try to zero
@@ -95,7 +95,7 @@
 	/* vm_page related parameters */
 
 		/* vm_page queues */
-	struct pgfreelist page_free[VM_NFREELIST]; /* unallocated pages */
+	struct pgfreelist *page_free;	/* unallocated pages */
 	bool page_init_done;		/* TRUE if uvm_page_init() finished */
 
 		/* page daemon trigger */

Index: src/sys/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.148.4.2.4.2 src/sys/uvm/uvm_extern.h:1.148.4.2.4.3
--- src/sys/uvm/uvm_extern.h:1.148.4.2.4.2	Wed May 25 23:58:49 2011
+++ src/sys/uvm/uvm_extern.h	Fri Jun  3 02:43:41 2011
@@ -331,8 +331,10 @@
    not available */
 	int zeroaborts;		/* number of times page zeroing was
    aborted */
+	int colorfail;		/* pagealloc where we got no page */
 	int colorhit;		/* pagealloc where we got optimal color */
 	int colormiss;		/* pagealloc where we didn't */
+	int colorany;		/* pagealloc where we wanted any color */
 	int cpuhit;		/* pagealloc where we allocated locally */
 	int cpumiss;		/* pagealloc where we didn't */
 
@@ -457,6 +459,8 @@
 	int64_t colorhit;
 	int64_t colormiss;
 	int64_t ncolors;
+	int64_t colorany;
+	int64_t colorfail;
 };
 
 #ifdef _KERNEL

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.263.4.3.4.4 src/sys/uvm/uvm_map.c:1.263.4.3.4.5
--- src/sys/uvm/uvm_map.c:1.263.4.3.4.4	Wed May 25 23:58:50 2011
+++ src/sys/uvm/uvm_map.c	Fri Jun  3 02:43:41 2011
@@ -4660,7 +4660,7 @@
 	}
 
 	error = uvm_map_prepare(map, 0, PAGE_SIZE, NULL, UVM_UNKNOWN_OFFSET,
-	VM_PAGE_TO_COLOR(pg), mapflags | UVM_FLAG_COLORMATCH, args);
+	VM_PGCOLOR_BUCKET(pg), mapflags | UVM_FLAG_COLORMATCH, args);
 	if (error) {
 		uvm_pagefree(pg);
 		return NULL;
@@ -5105,9 +5105,9 @@
 
 	/* cross-verify page queue */
 	if (pg-pqflags  PQ_FREE) {
-		int fl = uvm_page_lookup_freelist(pg);
+		int free_list = uvm_page_lookup_freelist(pg);
 		int color = VM_PGCOLOR_BUCKET(pg);
-		pgl = uvm.page_free[fl].pgfl_buckets[color].pgfl_queues[
+		pgl = uvm.page_free[color].pgfl_queues[free_list][
 		((pg)-flags  PG_ZERO) ? PGFL_ZEROS : PGFL_UNKNOWN];
 	} else {
 		pgl = NULL;

Index: src/sys/uvm/uvm_meter.c
diff -u src/sys/uvm/uvm_meter.c:1.49 src/sys/uvm/uvm_meter.c:1.49.16.1
--- src/sys/uvm/uvm_meter.c:1.49	Wed Jun  4 12:45:28 2008
+++ src/sys/uvm/uvm_meter.c	Fri Jun  3 02:43:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_meter.c,v 1.49 2008/06/04 12:45:28 ad Exp $	*/
+/*	uvm_meter.c,v 1.49 2008/06/04 12:45:28 ad Exp	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_meter.c,v 1.49 2008/06/04 12:45:28 ad Exp $);
+__KERNEL_RCSID(0, uvm_meter.c,v 1.49 2008/06/04 12:45:28 ad Exp);
 
 #include sys/param.h
 #include sys/proc.h
@@ -245,6 +245,8 @@
 	u.colormiss = uvmexp.colormiss;
 	u.cpuhit = uvmexp.cpuhit;
 	u.cpumiss = uvmexp.cpumiss;
+	u.colorany = uvmexp.colorany;
+	u.colorfail = uvmexp.colorfail;
 
 	node = *rnode;
 	node.sysctl_data = u;

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.3 

CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-06-02 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun  3 02:43:43 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm.h uvm_extern.h uvm_map.c uvm_meter.c
uvm_page.c uvm_page.h uvm_pager.c uvm_pdaemon.c uvm_pglist.c
uvm_pglist.h uvm_vnode.c

Log Message:
Rework page free lists to be sorted by color first rather than free_list.
Kept per color PGFL_* counter in each page free list.
Minor cleanups.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.16.1 src/sys/uvm/uvm.h
cvs rdiff -u -r1.148.4.2.4.2 -r1.148.4.2.4.3 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.263.4.3.4.4 -r1.263.4.3.4.5 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.49 -r1.49.16.1 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.140.6.3.4.3 -r1.140.6.3.4.4 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.55.14.3 -r1.55.14.4 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.92.18.1 -r1.92.18.2 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.93.4.2 -r1.93.4.2.4.1 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.42.16.8 -r1.42.16.9 src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.7 -r1.7.16.1 src/sys/uvm/uvm_pglist.h
cvs rdiff -u -r1.90.28.1 -r1.90.28.2 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.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-05-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri May 27 17:17:17 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Fix a bug where limit could be greater avail_end.  Now if that happens, we
just bail.  Use KDASSERTMSG so panics are more informative.


To generate a diff of this commit:
cvs rdiff -u -r1.42.16.7 -r1.42.16.8 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.42.16.7 src/sys/uvm/uvm_pglist.c:1.42.16.8
--- src/sys/uvm/uvm_pglist.c:1.42.16.7	Wed May 25 23:58:50 2011
+++ src/sys/uvm/uvm_pglist.c	Fri May 27 17:17:17 2011
@@ -170,6 +170,8 @@
 			second_pass = true;
 			try = roundup2(max(low, ps-avail_start), alignment);
 			limit = min(high, ps-avail_start + ps-start_hint);
+			if (limit = ps-avail_end)
+return 0;
 			skip = 0;
 			continue;
 		}
@@ -184,20 +186,28 @@
 			skip = 0;
 			continue;
 		}
-#ifdef DEBUG
+
 		/*
 		 * Make sure this is a managed physical page.
 		 */
+		KDASSERTMSG(vm_physseg_find(try, cidx) == ps - vm_physmem,
+		(%s: %s(%#x, cidx) (%d) != ps - vm_physmem (%zd),
+		 __func__, vm_physseg_find, try,
+		vm_physseg_find(try, cidx), ps - vm_physmem));
+
+		KDASSERTMSG(cidx == try - ps-start,
+		(%s: cidx (%#x) != try (%#x) - ps-start (%#PRIxPADDR),
+		 __func__, cidx, try, ps-start));
+
+		KDASSERTMSG(vm_physseg_find(try + num - 1, cidx) == ps - vm_physmem,
+		(%s: %s(%#x + %#x - 1, cidx) (%d) != ps - vm_physmem (%zd),
+		 __func__, vm_physseg_find, try, num,
+		vm_physseg_find(try, cidx), ps - vm_physmem));
+
+		KDASSERTMSG(cidx == try - ps-start + num - 1,
+		(%s: cidx (%#x) != try (%#x) - ps-start (%#PRIxPADDR) + num (%#x) - 1,
+		 __func__, cidx, try, ps-start, num));
 
-		if (vm_physseg_find(try, cidx) != ps - vm_physmem)
-			panic(pgalloc contig: botch1);
-		if (cidx != try - ps-start)
-			panic(pgalloc contig: botch2);
-		if (vm_physseg_find(try + num - 1, cidx) != ps - vm_physmem)
-			panic(pgalloc contig: botch3);
-		if (cidx != try - ps-start + num - 1)
-			panic(pgalloc contig: botch4);
-#endif
 		tryidx = try - ps-start;
 		end = tryidx + num;
 
@@ -390,21 +400,31 @@
 	second_pass = false;
 
 	for (;; try++, pg++) {
+		KDASSERTMSG(limit = ps-avail_end,
+		(%s: limit (%#x)  ps-avail_end (%#PRIxPADDR),
+		 __func__, limit, ps-avail_end));
+
 		if (try = limit) {
 			if (ps-start_hint == 0 || second_pass)
 break;
 			second_pass = true;
 			try = max(low, ps-avail_start) - 1;
 			limit = min(high, ps-avail_start + ps-start_hint);
+			if (limit = ps-avail_end)
+break;
 			pg = ps-pgs[try - ps-start];
 			continue;
 		}
-#ifdef DEBUG
-		if (vm_physseg_find(try, cidx) != ps - vm_physmem)
-			panic(pgalloc simple: botch1);
-		if (cidx != (try - ps-start))
-			panic(pgalloc simple: botch2);
-#endif
+
+		KDASSERTMSG(vm_physseg_find(try, cidx) == ps - vm_physmem,
+		(%s: %s(%#x, cidx) (%d) != ps - vm_physmem (%zd),
+		 __func__, vm_physseg_find, try,
+		vm_physseg_find(try, cidx), ps - vm_physmem));
+
+		KDASSERTMSG(cidx == try - ps-start,
+		(%s: cidx (%#x) != try (%#x) - ps-start (%#PRIxPADDR),
+		 __func__, cidx, try, ps-start));
+
 		/*
 		 * If this page isn't free, then we need to skip a colors worth
 		 * of pages to get a matching color.  Note that colormask is 1



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-05-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri May 27 17:17:17 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Fix a bug where limit could be greater avail_end.  Now if that happens, we
just bail.  Use KDASSERTMSG so panics are more informative.


To generate a diff of this commit:
cvs rdiff -u -r1.42.16.7 -r1.42.16.8 src/sys/uvm/uvm_pglist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:15:10 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_unix.c

Log Message:
Fix PRIdVSIZE macro


To generate a diff of this commit:
cvs rdiff -u -r1.40.28.1 -r1.40.28.2 src/sys/uvm/uvm_unix.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/uvm/uvm_unix.c
diff -u src/sys/uvm/uvm_unix.c:1.40.28.1 src/sys/uvm/uvm_unix.c:1.40.28.2
--- src/sys/uvm/uvm_unix.c:1.40.28.1	Sun Aug 23 06:38:07 2009
+++ src/sys/uvm/uvm_unix.c	Fri Apr 29 08:15:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_unix.c,v 1.40.28.1 2009/08/23 06:38:07 matt Exp $	*/
+/*	$NetBSD: uvm_unix.c,v 1.40.28.2 2011/04/29 08:15:09 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -50,7 +50,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_unix.c,v 1.40.28.1 2009/08/23 06:38:07 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_unix.c,v 1.40.28.2 2011/04/29 08:15:09 matt Exp $);
 
 #include opt_pax.h
 
@@ -118,7 +118,7 @@
 UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
 		if (error) {
 #ifndef PRIdVSIZE
-#define	PRIdVSIZE	%ld
+#define	PRIdVSIZE	ld
 #endif
 			uprintf(sbrk: grow %PRIdVSIZE failed, error = %d\n,
 new - old, error);



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:16:43 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.h

Log Message:
Add macros from current (VM_PAGE_TO_MD, VM_PHYSMEM_PTR, VM_PHYSMEM_PTR_SWAP)


To generate a diff of this commit:
cvs rdiff -u -r1.55.14.1 -r1.55.14.2 src/sys/uvm/uvm_page.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.55.14.1 src/sys/uvm/uvm_page.h:1.55.14.2
--- src/sys/uvm/uvm_page.h:1.55.14.1	Sat Jan 23 19:54:04 2010
+++ src/sys/uvm/uvm_page.h	Fri Apr 29 08:16:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.h,v 1.55.14.1 2010/01/23 19:54:04 matt Exp $	*/
+/*	$NetBSD: uvm_page.h,v 1.55.14.2 2011/04/29 08:16:42 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -255,6 +255,9 @@
 /*
  * physical memory config is stored in vm_physmem.
  */
+#define	VM_PHYSMEM_PTR(i)	(vm_physmem[i])
+#define	VM_PHYSMEM_PTR_SWAP(i, j) \
+	do { vm_physmem[(i)] = vm_physmem[(j)]; } while (0)
 
 extern struct vm_physseg vm_physmem[VM_PHYSSEG_MAX];
 extern int vm_nphysseg;
@@ -305,6 +308,10 @@
 
 #define VM_PAGE_TO_PHYS(entry)	((entry)-phys_addr)
 
+#ifdef __HAVE_VM_PAGE_MD
+#define VM_PAGE_TO_MD(pg)	((pg)-mdpage)
+#endif
+
 /*
  * Compute the page color bucket for a given page.
  */



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:15:10 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_unix.c

Log Message:
Fix PRIdVSIZE macro


To generate a diff of this commit:
cvs rdiff -u -r1.40.28.1 -r1.40.28.2 src/sys/uvm/uvm_unix.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:16:43 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.h

Log Message:
Add macros from current (VM_PAGE_TO_MD, VM_PHYSMEM_PTR, VM_PHYSMEM_PTR_SWAP)


To generate a diff of this commit:
cvs rdiff -u -r1.55.14.1 -r1.55.14.2 src/sys/uvm/uvm_page.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



re: CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-08-18 Thread matthew green

 Module Name:  src
 Committed By: matt
 Date: Wed Aug 18 18:19:11 UTC 2010
 
 Modified Files:
   src/sys/uvm [matt-nb5-mips64]: uvm_map.c
 
 Log Message:
 Add a hook so that MD code has handle the change in address space limits
 when an exec happens.
 Add a routine to turn on/off UX when an address space changes due to an exec
 (N32 execing a N64 for instance).

could you do this with #ifdef __HAVE_CPU_VMSPACE_EXEC?

thanks.


CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-08-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 18 18:19:11 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_map.c

Log Message:
Add a hook so that MD code has handle the change in address space limits
when an exec happens.
Add a routine to turn on/off UX when an address space changes due to an exec
(N32 execing a N64 for instance).


To generate a diff of this commit:
cvs rdiff -u -r1.263.4.3.4.1 -r1.263.4.3.4.2 src/sys/uvm/uvm_map.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/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.263.4.3.4.1 src/sys/uvm/uvm_map.c:1.263.4.3.4.2
--- src/sys/uvm/uvm_map.c:1.263.4.3.4.1	Sun Aug 23 06:38:07 2009
+++ src/sys/uvm/uvm_map.c	Wed Aug 18 18:19:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.263.4.3.4.1 2009/08/23 06:38:07 matt Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.263.4.3.4.2 2010/08/18 18:19:11 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.1 2009/08/23 06:38:07 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.263.4.3.4.2 2010/08/18 18:19:11 matt Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -4139,6 +4139,9 @@
 	/* XXX cgd 960926: the sparc #ifdef should be a MD hook */
 	kill_user_windows(l);   /* before stack addresses go away */
 #endif
+#if defined(__mips__)  defined(_LP64)
+	cpu_vmspace_exec(l, start, end);
+#endif
 
 	/*
 	 * see if more than one process is using this vmspace...



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  1 19:04:03 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Fix bad initialization spotted by Manuel Bouyer.


To generate a diff of this commit:
cvs rdiff -u -r1.42.16.5 -r1.42.16.6 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.42.16.5 src/sys/uvm/uvm_pglist.c:1.42.16.6
--- src/sys/uvm/uvm_pglist.c:1.42.16.5	Sat Jan 23 20:03:28 2010
+++ src/sys/uvm/uvm_pglist.c	Tue Jun  1 19:04:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.42.16.5 2010/01/23 20:03:28 matt Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.42.16.6 2010/06/01 19:04:02 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.5 2010/01/23 20:03:28 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.42.16.6 2010/06/01 19:04:02 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -148,7 +148,7 @@
 	limit = min(high, ps-avail_end);
 	pagemask = ~((boundary  PAGE_SHIFT) - 1);
 	skip = 0;
-	second_pass = true;
+	second_pass = false;
 	pgs = ps-pgs;
 
 	for (;;) {



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-26 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Jan 27 07:45:19 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.c

Log Message:
Remove JRT two line comment about cache interference since the
change specifically addresses general VIPT cache issue.  Need more
throughout comment cleanup about uvmexp.ncolor intent and significance.


To generate a diff of this commit:
cvs rdiff -u -r1.140.6.3.4.2 -r1.140.6.3.4.3 src/sys/uvm/uvm_page.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 26 21:26:28 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_extern.h uvm_fault.c uvm_km.c
uvm_page.c

Log Message:
Pass hints to uvm_pagealloc* to get it to use the right page color rather
than guess the right page color.


To generate a diff of this commit:
cvs rdiff -u -r1.148.4.2 -r1.148.4.2.4.1 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.125.6.1 -r1.125.6.1.4.1 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.101.4.2.4.1 -r1.101.4.2.4.2 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.140.6.3.4.1 -r1.140.6.3.4.2 src/sys/uvm/uvm_page.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/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.148.4.2 src/sys/uvm/uvm_extern.h:1.148.4.2.4.1
--- src/sys/uvm/uvm_extern.h:1.148.4.2	Wed Apr  1 00:25:23 2009
+++ src/sys/uvm/uvm_extern.h	Tue Jan 26 21:26:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.148.4.2 2009/04/01 00:25:23 snj Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.148.4.2.4.1 2010/01/26 21:26:28 matt Exp $	*/
 
 /*
  *
@@ -146,6 +146,7 @@
 #define UVM_FLAG_QUANTUM 0x80 /* entry can never be split later */
 #define UVM_FLAG_WAITVA  0x100 /* wait for va */
 #define UVM_FLAG_VAONLY  0x200 /* unmap: no pages are mapped */
+#define UVM_FLAG_COLORMATCH 0x400 /* match color given in off */
 
 /* macros to extract info */
 #define UVM_PROTECTION(X)	((X)  UVM_PROT_MASK)

Index: src/sys/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.125.6.1 src/sys/uvm/uvm_fault.c:1.125.6.1.4.1
--- src/sys/uvm/uvm_fault.c:1.125.6.1	Mon Feb  2 18:31:37 2009
+++ src/sys/uvm/uvm_fault.c	Tue Jan 26 21:26:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.125.6.1 2009/02/02 18:31:37 snj Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.125.6.1.4.1 2010/01/26 21:26:28 matt Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.125.6.1 2009/02/02 18:31:37 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.125.6.1.4.1 2010/01/26 21:26:28 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -362,7 +362,8 @@
 			 * no page, we must try and bring it in.
 			 */
 
-			pg = uvm_pagealloc(NULL, 0, anon, 0);
+			pg = uvm_pagealloc(NULL, ufi-orig_rvaddr,
+			NULL, UVM_FLAG_COLORMATCH);
 			if (pg == NULL) {		/* out of RAM.  */
 uvmfault_unlockall(ufi, amap, NULL, anon);
 uvmexp.fltnoram++;
@@ -620,8 +621,8 @@
 		 * so have uvm_pagealloc() do that for us.
 		 */
 
-		pg = uvm_pagealloc(NULL, 0, anon,
-		(opg == NULL) ? UVM_PGA_ZERO : 0);
+		pg = uvm_pagealloc(NULL, ufi-orig_rvaddr, anon,
+		UVM_FLAG_COLORMATCH | (opg == NULL ? UVM_PGA_ZERO : 0));
 	} else {
 		pg = NULL;
 	}
@@ -1266,7 +1267,8 @@
 			if (anon-an_ref == 1) {
 
 /* get new un-owned replacement page */
-pg = uvm_pagealloc(NULL, 0, NULL, 0);
+pg = uvm_pagealloc(NULL, ufi.orig_rvaddr,
+NULL, UVM_FLAG_COLORMATCH);
 if (pg == NULL) {
 	uvmfault_unlockall(ufi, amap, uobj,
 	anon);

Index: src/sys/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.101.4.2.4.1 src/sys/uvm/uvm_km.c:1.101.4.2.4.2
--- src/sys/uvm/uvm_km.c:1.101.4.2.4.1	Sat Jan  9 05:54:40 2010
+++ src/sys/uvm/uvm_km.c	Tue Jan 26 21:26:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.1 2010/01/09 05:54:40 matt Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.2 2010/01/26 21:26:28 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.1 2010/01/09 05:54:40 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.101.4.2.4.2 2010/01/26 21:26:28 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -589,7 +589,7 @@
 	loopva = kva;
 	loopsize = size;
 
-	pgaflags = 0;
+	pgaflags = UVM_FLAG_COLORMATCH;
 	if (flags  UVM_KMF_NOWAIT)
 		pgaflags |= UVM_PGA_USERESERVE;
 	if (flags  UVM_KMF_ZERO)

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.1 src/sys/uvm/uvm_page.c:1.140.6.3.4.2
--- src/sys/uvm/uvm_page.c:1.140.6.3.4.1	Sat Sep 12 18:38:46 2009
+++ src/sys/uvm/uvm_page.c	Tue Jan 26 21:26:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.1 2009/09/12 18:38:46 matt Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.2 2010/01/26 21:26:28 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.1 2009/09/12 18:38:46 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.140.6.3.4.2 2010/01/26 21:26:28 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -1074,7 +1074,7 @@
 	lwp_t *l;
 
 	KASSERT(obj == NULL || anon == NULL);
-	KASSERT(anon == NULL || off == 0);
+	KASSERT(anon == NULL || (flags  UVM_FLAG_COLORMATCH) || off == 0);
 	KASSERT(off == trunc_page(off));
 	KASSERT(obj == NULL || 

CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-26 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Jan 27 07:45:19 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.c

Log Message:
Remove JRT two line comment about cache interference since the
change specifically addresses general VIPT cache issue.  Need more
throughout comment cleanup about uvmexp.ncolor intent and significance.


To generate a diff of this commit:
cvs rdiff -u -r1.140.6.3.4.2 -r1.140.6.3.4.3 src/sys/uvm/uvm_page.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/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3.4.2 src/sys/uvm/uvm_page.c:1.140.6.3.4.3
--- src/sys/uvm/uvm_page.c:1.140.6.3.4.2	Tue Jan 26 21:26:28 2010
+++ src/sys/uvm/uvm_page.c	Wed Jan 27 07:45:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.2 2010/01/26 21:26:28 matt Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.3 2010/01/27 07:45:19 nisimura 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.2 2010/01/26 21:26:28 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.140.6.3.4.3 2010/01/27 07:45:19 nisimura Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -1084,8 +1084,6 @@
 	/*
 	 * This implements a global round-robin page coloring
 	 * algorithm.
-	 *
-	 * XXXJRT: What about virtually-indexed caches?
 	 */
 
 	ucpu = curcpu()-ci_data.cpu_uvm;



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 23 19:54:04 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.h uvm_pglist.c

Log Message:
Add a start_hint to vm_physseg so when allocating pages, we can skip
forward over pages that are probably still allocated.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.14.1 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.42.16.3 -r1.42.16.4 src/sys/uvm/uvm_pglist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 23 19:54:04 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.h uvm_pglist.c

Log Message:
Add a start_hint to vm_physseg so when allocating pages, we can skip
forward over pages that are probably still allocated.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.14.1 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.42.16.3 -r1.42.16.4 src/sys/uvm/uvm_pglist.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/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.55 src/sys/uvm/uvm_page.h:1.55.14.1
--- src/sys/uvm/uvm_page.h:1.55	Wed Jun  4 15:06:04 2008
+++ src/sys/uvm/uvm_page.h	Sat Jan 23 19:54:04 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.h,v 1.55 2008/06/04 15:06:04 ad Exp $	*/
+/*	$NetBSD: uvm_page.h,v 1.55.14.1 2010/01/23 19:54:04 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -234,9 +234,11 @@
 	paddr_t	end;			/* (PF# of last page in segment) + 1 */
 	paddr_t	avail_start;		/* PF# of first free page in segment */
 	paddr_t	avail_end;		/* (PF# of last free page in segment) +1  */
-	int	free_list;		/* which free list they belong on */
 	struct	vm_page *pgs;		/* vm_page structures (from start) */
 	struct	vm_page *lastpg;	/* vm_page structure for end */
+	int	free_list;		/* which free list they belong on */
+	u_int	start_hint;		/* start looking for free pages here */
+	/* protected by uvm_fpageqlock */
 #ifdef __HAVE_PMAP_PHYSSEG
 	struct	pmap_physseg pmseg;	/* pmap specific (MD) data */
 #endif

Index: src/sys/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.42.16.3 src/sys/uvm/uvm_pglist.c:1.42.16.4
--- src/sys/uvm/uvm_pglist.c:1.42.16.3	Fri Jan 22 08:54:41 2010
+++ src/sys/uvm/uvm_pglist.c	Sat Jan 23 19:54:04 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.42.16.3 2010/01/22 08:54:41 matt Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.42.16.4 2010/01/23 19:54:04 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.3 2010/01/22 08:54:41 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.42.16.4 2010/01/23 19:54:04 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -122,9 +122,9 @@
 paddr_t alignment, paddr_t boundary, struct pglist *rlist)
 {
 	signed int try, limit, tryidx, end, idx, skip;
-	const signed int align = atop(alignment);
 	struct vm_page *pgs;
 	int pagemask;
+	bool second_pass;
 #ifdef DEBUG
 	paddr_t idxpa, lastidxpa;
 	int cidx = 0;	/* XXX: GCC */
@@ -136,20 +136,42 @@
 
 	KASSERT(mutex_owned(uvm_fpageqlock));
 
-	try = roundup(max(atop(low), ps-avail_start), align);
-	limit = min(atop(high), ps-avail_end);
+	low = atop(low);
+	high = atop(high);
+	alignment = atop(alignment);
+
+	/*
+	 * We start our search at the just after where the last allocation
+	 * succeeded.
+	 */
+	try = roundup(max(low, ps-avail_start + ps-start_hint), alignment);
+	limit = min(high, ps-avail_end);
 	pagemask = ~((boundary  PAGE_SHIFT) - 1);
 	skip = 0;
+	second_pass = true;
+	pgs = ps-pgs;
 
 	for (;;) {
 		bool ok = true;
-		int cnt;
+		signed int cnt;
 
 		if (try + num  limit) {
+			if (ps-start_hint == 0 || second_pass) {
+/*
+ * We've run past the allowable range.
+ */
+return 0; /* FAIL = 0 pages*/
+			}
 			/*
-			 * We've run past the allowable range.
+			 * We've wrapped around the end of this segment
+			 * so restart at the beginning but now our limit
+			 * is were we started.
 			 */
-			return (0); /* FAIL */
+			second_pass = true;
+			try = roundup(max(low, ps-avail_start), alignment);
+			limit = min(high, ps-avail_start + ps-start_hint);
+			skip = 0;
+			continue;
 		}
 		if (boundary != 0 
 		((try ^ (try + num - 1))  pagemask) != 0) {
@@ -158,7 +180,8 @@
 			 * just crossed and ensure alignment.
 			 */
 			try = (try + num - 1)  pagemask;
-			try = roundup(try, align);
+			try = roundup(try, alignment);
+			skip = 0;
 			continue;
 		}
 #ifdef DEBUG
@@ -177,14 +200,13 @@
 #endif
 		tryidx = try - ps-start;
 		end = tryidx + num;
-		pgs = ps-pgs;
 
 		/*
 		 * Found a suitable starting page.  See if the range is free.
 		 */
 #ifdef PGALLOC_VERBOSE
 		printf(%s: ps=%p try=%#x end=%#x skip=%#x, align=%#x,
-		__func__, ps, tryidx, end, skip, align);
+		__func__, ps, tryidx, end, skip, alignment);
 #endif
 		/*
 		 * We start at the end and work backwards since if we find a
@@ -243,7 +265,7 @@
 		/*
 		 * now round up that to the needed alignment.
 		 */
-		cnt = roundup(cnt, align);
+		cnt = roundup(cnt, alignment);
 		/*
 		 * The number of pages we can skip checking 
 		 * (might be 0 if cnt  num).
@@ -258,10 +280,16 @@
 	for (idx = tryidx, pgs += idx; idx  end; idx++, pgs++)
 		uvm_pglist_add(pgs, rlist);
 
+	/*
+	 * the next time we need to search this segment, start after this
+	 * chunk of 

CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 23 20:03:28 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Use roundup2 instead of roundup when doing alignment rounding since all
alignments must be a power of 2. (thanks to rmind for suggesting it).


To generate a diff of this commit:
cvs rdiff -u -r1.42.16.4 -r1.42.16.5 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.42.16.4 src/sys/uvm/uvm_pglist.c:1.42.16.5
--- src/sys/uvm/uvm_pglist.c:1.42.16.4	Sat Jan 23 19:54:04 2010
+++ src/sys/uvm/uvm_pglist.c	Sat Jan 23 20:03:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.42.16.4 2010/01/23 19:54:04 matt Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.42.16.5 2010/01/23 20:03:28 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.4 2010/01/23 19:54:04 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.42.16.5 2010/01/23 20:03:28 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -144,7 +144,7 @@
 	 * We start our search at the just after where the last allocation
 	 * succeeded.
 	 */
-	try = roundup(max(low, ps-avail_start + ps-start_hint), alignment);
+	try = roundup2(max(low, ps-avail_start + ps-start_hint), alignment);
 	limit = min(high, ps-avail_end);
 	pagemask = ~((boundary  PAGE_SHIFT) - 1);
 	skip = 0;
@@ -168,7 +168,7 @@
 			 * is were we started.
 			 */
 			second_pass = true;
-			try = roundup(max(low, ps-avail_start), alignment);
+			try = roundup2(max(low, ps-avail_start), alignment);
 			limit = min(high, ps-avail_start + ps-start_hint);
 			skip = 0;
 			continue;
@@ -180,7 +180,7 @@
 			 * just crossed and ensure alignment.
 			 */
 			try = (try + num - 1)  pagemask;
-			try = roundup(try, alignment);
+			try = roundup2(try, alignment);
 			skip = 0;
 			continue;
 		}
@@ -265,7 +265,7 @@
 		/*
 		 * now round up that to the needed alignment.
 		 */
-		cnt = roundup(cnt, alignment);
+		cnt = roundup2(cnt, alignment);
 		/*
 		 * The number of pages we can skip checking 
 		 * (might be 0 if cnt  num).
@@ -499,7 +499,7 @@
 	if (boundary != 0  boundary  size)
 		return (EINVAL);
 	num = atop(round_page(size));
-	low = roundup(low, alignment);
+	low = roundup2(low, alignment);
 
 	TAILQ_INIT(rlist);
 



Re: CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-22 Thread Matt Thomas

On Jan 22, 2010, at 12:28 AM, enami tsugutomo wrote:

 Module Name: src
 Committed By:matt
 Date:Fri Jan 22 05:17:32 UTC 2010
 
 Modified Files:
  src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c
 
 Log Message:
 Rework the algorithm to allocate contiguous pages to be much much faster.
 (read the comments if you want to know how it's done).
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.42 -r1.42.16.1 src/sys/uvm/uvm_pglist.c
 
   /*
* Test both the ending and starting pages to see if they are
* both free.  If the ending and starting pages are same page,
* we only test one of them.  If the pages aren't free, there
* is no reason to continue this iteration so advance to the
* next address and try again.
*/
   if (VM_PAGE_IS_FREE(pgs[end - 1]) == 0
   || end - 1 == tryidx + skip
   || VM_PAGE_IS_FREE(pgs[tryidx + skip]) == 0) {
   try += roundup(num, align);
   skip = 0;
   continue;
   }
 
 I guess this part can be improved and/or fixed as below.

I initially did something like that but realized it didn't really buy me 
anything since the compiler will actually do something like that anyways.

Re: CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-22 Thread enami tsugutomo
  To generate a diff of this commit:
  cvs rdiff -u -r1.42 -r1.42.16.1 src/sys/uvm/uvm_pglist.c
 
/*
 * Test both the ending and starting pages to see if =
 they are
 * both free.  If the ending and starting pages are =
 same page,
 * we only test one of them.  If the pages aren't free, =
 there
 * is no reason to continue this iteration so advance =
 to the
 * next address and try again.
 */
if (VM_PAGE_IS_FREE(pgs[end - 1]) == 0
|| end - 1 == tryidx + skip
|| VM_PAGE_IS_FREE(pgs[tryidx + skip]) == 0) {
try += roundup(num, align);
skip = 0;
continue;
}
 
  I guess this part can be improved and/or fixed as below.
 
 I initially did something like that but realized it didn't really buy me
 anything since the compiler will actually do something like that
 anyways.

Ah, you're missing my point.  Let me rephrase again.

1) If `VM_PAGE_IS_FREE(pgs[end - 1]) == 0' is false and `end - 1 ==
   tryidx + skip' is true, above code skips the region but actually we
   found the enough space.

2) If `VM_PAGE_IS_FREE(pgs[end - 1]) == 0' is false and `end - 1 ==
   tryidx + skip' is false but `VM_PAGE_IS_FREE(pgs[tryidx + skip])
   == 0' is true, it is better to advance the `try' by roundup(skip +
   1, align) instead of roundup(num, align).

enami.


CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jan 22 08:54:41 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Remove some optimizations since they actually don't do the right thing.
We never want to test the starting page first since it doesn't really give
use any good information that we can use for the next pass.


To generate a diff of this commit:
cvs rdiff -u -r1.42.16.2 -r1.42.16.3 src/sys/uvm/uvm_pglist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jan 22 08:54:41 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Remove some optimizations since they actually don't do the right thing.
We never want to test the starting page first since it doesn't really give
use any good information that we can use for the next pass.


To generate a diff of this commit:
cvs rdiff -u -r1.42.16.2 -r1.42.16.3 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.42.16.2 src/sys/uvm/uvm_pglist.c:1.42.16.3
--- src/sys/uvm/uvm_pglist.c:1.42.16.2	Fri Jan 22 06:05:16 2010
+++ src/sys/uvm/uvm_pglist.c	Fri Jan 22 08:54:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.42.16.2 2010/01/22 06:05:16 snj Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.42.16.3 2010/01/22 08:54:41 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.2 2010/01/22 06:05:16 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.42.16.3 2010/01/22 08:54:41 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -187,41 +187,22 @@
 		__func__, ps, tryidx, end, skip, align);
 #endif
 		/*
-		 * Test both the ending and starting pages to see if they are
-		 * both free.  If the ending and starting pages are same page,
-		 * we only test one of them.  If the pages aren't free, there
-		 * is no reason to continue this iteration so advance to the
-		 * next address and try again.
-		 */
-		if (VM_PAGE_IS_FREE(pgs[end - 1]) == 0
-		|| end - 1 == tryidx + skip
-		|| VM_PAGE_IS_FREE(pgs[tryidx + skip]) == 0) {
-			try += roundup(num, align);
-			skip = 0;
-			continue;
-		}
-
-		/*
-		 * We start at the end since if we find a non-free page, it
-		 * makes no sense to ever test any pages before it since the
-		 * conditions for this allocation could never be satisified.
-		 *
-		 * Also since we have vetted these free pages, if this
-		 * iteration fails, we may be able to skip testing those pages
-		 * in the next iteration.
+		 * We start at the end and work backwards since if we find a
+		 * non-free page, it makes no sense to continue.
 		 *
-		 * The loop condition will never be satisfied if we've already
-		 * found enough pages (either one or two).
+		 * But on the plus size we have vetted some number of free
+		 * pages.  If this iteration fails, we may be able to skip
+		 * testing most of those pages again in the next pass.
 		 */
-		for (idx = end - 2; idx = tryidx + skip + 1; idx--) {
+		for (idx = end - 1; idx = tryidx + skip; idx--) {
 			if (VM_PAGE_IS_FREE(pgs[idx]) == 0) {
 ok = false;
 break;
 			}
 
 #ifdef DEBUG
-			idxpa = VM_PAGE_TO_PHYS(pgs[idx]);
 			if (idx  tryidx) {
+idxpa = VM_PAGE_TO_PHYS(pgs[idx]);
 lastidxpa = VM_PAGE_TO_PHYS(pgs[idx - 1]);
 if ((lastidxpa + PAGE_SIZE) != idxpa) {
 	/*



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jan 22 04:03:22 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_stat.c

Log Message:
Print out colors in uvmexp_print


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.12.1 src/sys/uvm/uvm_stat.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/uvm/uvm_stat.c
diff -u src/sys/uvm/uvm_stat.c:1.31 src/sys/uvm/uvm_stat.c:1.31.12.1
--- src/sys/uvm/uvm_stat.c:1.31	Fri Aug  8 17:09:28 2008
+++ src/sys/uvm/uvm_stat.c	Fri Jan 22 04:03:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_stat.c,v 1.31 2008/08/08 17:09:28 skrll Exp $	 */
+/*	$NetBSD: uvm_stat.c,v 1.31.12.1 2010/01/22 04:03:21 matt Exp $	 */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_stat.c,v 1.31 2008/08/08 17:09:28 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_stat.c,v 1.31.12.1 2010/01/22 04:03:21 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -212,9 +212,9 @@
 	uvm_estimatepageable(active, inactive);
 
 	(*pr)(Current UVM status:\n);
-	(*pr)(  pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n,
+	(*pr)(  pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d, ncolors=%d\n,
 	uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask,
-	uvmexp.pageshift);
+	uvmexp.pageshift, uvmexp.ncolors);
 	(*pr)(  %d VM pages: %d active, %d inactive, %d wired, %d free\n,
 	uvmexp.npages, active, inactive, uvmexp.wired,
 	uvmexp.free);



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jan 22 05:17:32 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Rework the algorithm to allocate contiguous pages to be much much faster.
(read the comments if you want to know how it's done).


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.16.1 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.42 src/sys/uvm/uvm_pglist.c:1.42.16.1
--- src/sys/uvm/uvm_pglist.c:1.42	Wed Jun  4 12:45:28 2008
+++ src/sys/uvm/uvm_pglist.c	Fri Jan 22 05:17:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.42 2008/06/04 12:45:28 ad Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.42.16.1 2010/01/22 05:17:32 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 2008/06/04 12:45:28 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.42.16.1 2010/01/22 05:17:32 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -82,9 +82,6 @@
 uvm_pglist_add(struct vm_page *pg, struct pglist *rlist)
 {
 	int free_list, color, pgflidx;
-#ifdef DEBUG
-	struct vm_page *tp;
-#endif
 
 	KASSERT(mutex_owned(uvm_fpageqlock));
 
@@ -95,11 +92,11 @@
 	free_list = uvm_page_lookup_freelist(pg);
 	color = VM_PGCOLOR_BUCKET(pg);
 	pgflidx = (pg-flags  PG_ZERO) ? PGFL_ZEROS : PGFL_UNKNOWN;
-#ifdef DEBUG
-	for (tp = LIST_FIRST(uvm.page_free[
-		free_list].pgfl_buckets[color].pgfl_queues[pgflidx]);
-	 tp != NULL;
-	 tp = LIST_NEXT(tp, pageq.list)) {
+#if defined(DEBUG)  DEBUG  1
+	struct vm_page *tp;
+	LIST_FOREACH(tp,
+	uvm.page_free[free_list].pgfl_buckets[color].pgfl_queues[pgflidx],
+	pageq.list) {
 		if (tp == pg)
 			break;
 	}
@@ -124,7 +121,8 @@
 uvm_pglistalloc_c_ps(struct vm_physseg *ps, int num, paddr_t low, paddr_t high,
 paddr_t alignment, paddr_t boundary, struct pglist *rlist)
 {
-	int try, limit, tryidx, end, idx;
+	signed int try, limit, tryidx, end, idx, skip;
+	const signed int align = atop(alignment);
 	struct vm_page *pgs;
 	int pagemask;
 #ifdef DEBUG
@@ -138,11 +136,15 @@
 
 	KASSERT(mutex_owned(uvm_fpageqlock));
 
-	try = roundup(max(atop(low), ps-avail_start), atop(alignment));
+	try = roundup(max(atop(low), ps-avail_start), align);
 	limit = min(atop(high), ps-avail_end);
 	pagemask = ~((boundary  PAGE_SHIFT) - 1);
+	skip = 0;
 
 	for (;;) {
+		bool ok = true;
+		int cnt;
+
 		if (try + num  limit) {
 			/*
 			 * We've run past the allowable range.
@@ -156,7 +158,7 @@
 			 * just crossed and ensure alignment.
 			 */
 			try = (try + num - 1)  pagemask;
-			try = roundup(try, atop(alignment));
+			try = roundup(try, align);
 			continue;
 		}
 #ifdef DEBUG
@@ -180,9 +182,42 @@
 		/*
 		 * Found a suitable starting page.  See if the range is free.
 		 */
-		for (idx = tryidx; idx  end; idx++) {
-			if (VM_PAGE_IS_FREE(pgs[idx]) == 0)
+#ifdef PGALLOC_VERBOSE
+		printf(%s: ps=%p try=%#x end=%#x skip=%#x, align=%#x,
+		__func__, ps, tryidx, end, skip, align);
+#endif
+		/*
+		 * Test both the ending and starting pages to see if they are
+		 * both free.  If the ending and starting pages are same page,
+		 * we only test one of them.  If the pages aren't free, there
+		 * is no reason to continue this iteration so advance to the
+		 * next address and try again.
+		 */
+		if (VM_PAGE_IS_FREE(pgs[end - 1]) == 0
+		|| end - 1 == tryidx + skip
+		|| VM_PAGE_IS_FREE(pgs[tryidx + skip]) == 0) {
+			try += roundup(num, align);
+			skip = 0;
+			continue;
+		}
+
+		/*
+		 * We start at the end since if we find a non-free page, it
+		 * make no sense to ever test any pages before it since the
+		 * conditions for this allocation could never be satisified.
+		 *
+		 * Also since we have vetted these free pages, if this
+		 * iteration fails, we may be able to skip testing those pages
+		 * in the next iteration.
+		 *
+		 * The loop condition will never be satisfied if we've already
+		 * found enough pages (either one or two).
+		 */
+		for (idx = end - 2; idx = tryidx + skip + 1; idx--) {
+			if (VM_PAGE_IS_FREE(pgs[idx]) == 0) {
+ok = false;
 break;
+			}
 
 #ifdef DEBUG
 			idxpa = VM_PAGE_TO_PHYS(pgs[idx]);
@@ -205,18 +240,42 @@
 			}
 #endif
 		}
-		if (idx == end)
+
+		if (ok) {
+			while (skip--  0) {
+KDASSERT(VM_PAGE_IS_FREE(pgs[tryidx + skip]));
+			}
+#ifdef PGALLOC_VERBOSE
+			printf(: ok\n);
+#endif
 			break;
+		}
 
-		try += atop(alignment);
+#ifdef PGALLOC_VERBOSE
+		printf(: non-free at %#x\n, idx - tryidx);
+#endif
+		/*
+		 * count the number of pages we can advance
+		 * since we know they aren't all free.
+		 */
+		cnt = idx + 1 - tryidx;
+		/*
+		 * now round up that to the needed alignment.
+		 */
+		cnt = roundup(cnt, align);
+		/*
+		 * The number of pages we can skip 

CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-21 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jan 22 06:05:16 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_pglist.c

Log Message:
Fix a couple comment typos.


To generate a diff of this commit:
cvs rdiff -u -r1.42.16.1 -r1.42.16.2 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.42.16.1 src/sys/uvm/uvm_pglist.c:1.42.16.2
--- src/sys/uvm/uvm_pglist.c:1.42.16.1	Fri Jan 22 05:17:32 2010
+++ src/sys/uvm/uvm_pglist.c	Fri Jan 22 06:05:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.42.16.1 2010/01/22 05:17:32 matt Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.42.16.2 2010/01/22 06:05:16 snj 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.1 2010/01/22 05:17:32 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.42.16.2 2010/01/22 06:05:16 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -203,7 +203,7 @@
 
 		/*
 		 * We start at the end since if we find a non-free page, it
-		 * make no sense to ever test any pages before it since the
+		 * makes no sense to ever test any pages before it since the
 		 * conditions for this allocation could never be satisified.
 		 *
 		 * Also since we have vetted these free pages, if this
@@ -265,7 +265,7 @@
 		cnt = roundup(cnt, align);
 		/*
 		 * The number of pages we can skip checking 
-		 * (might be 0 is cnt  num).
+		 * (might be 0 if cnt  num).
 		 */
 		skip = max(num - cnt, 0);
 		try += cnt;



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan  9 05:54:40 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_km.c

Log Message:
If PMAP_ALLOC_POOLPAGE is defined use it instead of uvm_pagealloc


To generate a diff of this commit:
cvs rdiff -u -r1.101.4.2 -r1.101.4.2.4.1 src/sys/uvm/uvm_km.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-01-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan  9 05:54:40 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_km.c

Log Message:
If PMAP_ALLOC_POOLPAGE is defined use it instead of uvm_pagealloc


To generate a diff of this commit:
cvs rdiff -u -r1.101.4.2 -r1.101.4.2.4.1 src/sys/uvm/uvm_km.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/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.101.4.2 src/sys/uvm/uvm_km.c:1.101.4.2.4.1
--- src/sys/uvm/uvm_km.c:1.101.4.2	Sun Apr 19 15:43:14 2009
+++ src/sys/uvm/uvm_km.c	Sat Jan  9 05:54:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.101.4.2 2009/04/19 15:43:14 snj Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.101.4.2.4.1 2010/01/09 05:54:40 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 2009/04/19 15:43:14 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.101.4.2.4.1 2010/01/09 05:54:40 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -725,8 +725,13 @@
 	struct vm_page *pg;
 	vaddr_t va;
 
+
  again:
+#ifdef PMAP_ALLOC_POOLPAGE
+	pg = PMAP_ALLOC_POOLPAGE(waitok ? 0 : UVM_PGA_USERESERVE);
+#else
 	pg = uvm_pagealloc(NULL, 0, NULL, waitok ? 0 : UVM_PGA_USERESERVE);
+#endif
 	if (__predict_false(pg == NULL)) {
 		if (waitok) {
 			uvm_wait(plpg);



CVS commit: [matt-nb5-mips64] src/sys/uvm

2009-09-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Sep 12 18:38:46 UTC 2009

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.c

Log Message:
Add KASSERT(pg) to uvm_pagefree() so that invalid physical address passed
to VM_PHYS_TO_PAGE will be easily caught.


To generate a diff of this commit:
cvs rdiff -u -r1.140.6.3 -r1.140.6.3.4.1 src/sys/uvm/uvm_page.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/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.140.6.3 src/sys/uvm/uvm_page.c:1.140.6.3.4.1
--- src/sys/uvm/uvm_page.c:1.140.6.3	Mon Mar  2 20:51:35 2009
+++ src/sys/uvm/uvm_page.c	Sat Sep 12 18:38:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.140.6.3 2009/03/02 20:51:35 snj Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.140.6.3.4.1 2009/09/12 18:38:46 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 2009/03/02 20:51:35 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.140.6.3.4.1 2009/09/12 18:38:46 matt Exp $);
 
 #include opt_uvmhist.h
 #include opt_readahead.h
@@ -1345,6 +1345,8 @@
 	int index, color, queue;
 	bool iszero;
 
+	KASSERT(pg);
+
 #ifdef DEBUG
 	if (pg-uobject == (void *)0xdeadbeef 
 	pg-uanon == (void *)0xdeadbeef) {