Module Name:    src
Committed By:   rmind
Date:           Sat Apr 23 18:14:13 UTC 2011

Modified Files:
        src/sys/uvm: uvm_amap.c uvm_amap.h uvm_anon.c uvm_aobj.c uvm_device.c
            uvm_extern.h uvm_fault.c uvm_init.c uvm_io.c uvm_kmguard.c
            uvm_loan.c uvm_mmap.c uvm_pager.c uvm_pglist.c uvm_stat.h
            uvm_swap.c uvm_vnode.c

Log Message:
Replace "malloc" in comments, remove unnecessary header inclusions.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/uvm/uvm_amap.c
cvs rdiff -u -r1.35 -r1.36 src/sys/uvm/uvm_amap.h
cvs rdiff -u -r1.52 -r1.53 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.113 -r1.114 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.60 -r1.61 src/sys/uvm/uvm_device.c src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.171 -r1.172 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.183 -r1.184 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.39 -r1.40 src/sys/uvm/uvm_init.c
cvs rdiff -u -r1.25 -r1.26 src/sys/uvm/uvm_io.c
cvs rdiff -u -r1.4 -r1.5 src/sys/uvm/uvm_kmguard.c
cvs rdiff -u -r1.78 -r1.79 src/sys/uvm/uvm_loan.c
cvs rdiff -u -r1.134 -r1.135 src/sys/uvm/uvm_mmap.c
cvs rdiff -u -r1.99 -r1.100 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.48 -r1.49 src/sys/uvm/uvm_stat.h
cvs rdiff -u -r1.153 -r1.154 src/sys/uvm/uvm_swap.c
cvs rdiff -u -r1.94 -r1.95 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_amap.c
diff -u src/sys/uvm/uvm_amap.c:1.89 src/sys/uvm/uvm_amap.c:1.90
--- src/sys/uvm/uvm_amap.c:1.89	Wed Feb  2 15:13:33 2011
+++ src/sys/uvm/uvm_amap.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_amap.c,v 1.89 2011/02/02 15:13:33 chuck Exp $	*/
+/*	$NetBSD: uvm_amap.c,v 1.90 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -35,13 +35,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.89 2011/02/02 15:13:33 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.90 2011/04/23 18:14:12 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/proc.h>
 #include <sys/kernel.h>
 #include <sys/kmem.h>
 #include <sys/pool.h>
@@ -98,8 +97,8 @@
  * when enabled, an array of ints is allocated for the pprefs.  this
  * array is allocated only when a partial reference is added to the
  * map (either by unmapping part of the amap, or gaining a reference
- * to only a part of an amap).  if the malloc of the array fails
- * (M_NOWAIT), then we set the array pointer to PPREF_NONE to indicate
+ * to only a part of an amap).  if the allocation of the array fails
+ * (KM_NOSLEEP), then we set the array pointer to PPREF_NONE to indicate
  * that we tried to do ppref's but couldn't alloc the array so just
  * give up (after all, this is an optional feature!).
  *
@@ -190,6 +189,10 @@
 	amap->am_nslot = slots;
 	amap->am_nused = 0;
 
+	/*
+	 * Note: since allocations are likely big, we expect to reduce the
+	 * memory fragmentation by allocating them in separate blocks.
+	 */
 	amap->am_slots = kmem_alloc(totalslots * sizeof(int), kmflags);
 	if (amap->am_slots == NULL)
 		goto fail1;
@@ -475,15 +478,15 @@
 	}
 
 	/*
-	 * case 3: we need to malloc a new amap and copy all the amap
-	 * data over from old amap to the new one.
+	 * Case 3: we need to allocate a new amap and copy all the amap
+	 * data over from old amap to the new one.  Drop the lock before
+	 * performing allocation.
 	 *
-	 * note that the use of a kernel realloc() probably would not
-	 * help here, since we wish to abort cleanly if one of the
-	 * three (or four) mallocs fails.
+	 * Note: since allocations are likely big, we expect to reduce the
+	 * memory fragmentation by allocating them in separate blocks.
 	 */
 
-	amap_unlock(amap);	/* unlock in case we sleep in malloc */
+	amap_unlock(amap);
 
 	if (slotneed >= UVM_AMAP_LARGE) {
 		return E2BIG;
@@ -492,8 +495,10 @@
 	slotalloc = amap_roundup_slots(slotneed);
 #ifdef UVM_AMAP_PPREF
 	newppref = NULL;
-	if (amap->am_ppref && amap->am_ppref != PPREF_NONE)
+	if (amap->am_ppref && amap->am_ppref != PPREF_NONE) {
+		/* Will be handled later if fails. */
 		newppref = kmem_alloc(slotalloc * sizeof(*newppref), kmflags);
+	}
 #endif
 	newsl = kmem_alloc(slotalloc * sizeof(*newsl), kmflags);
 	newbck = kmem_alloc(slotalloc * sizeof(*newbck), kmflags);
@@ -519,7 +524,7 @@
 	KASSERT(amap->am_maxslot < slotneed);
 
 	/*
-	 * now copy everything over to new malloc'd areas...
+	 * Copy everything over to new allocated areas.
 	 */
 
 	slotadded = slotalloc - amap->am_nslot;
@@ -829,7 +834,7 @@
 	/*
 	 * need to double check reference count now that we've got the
 	 * src amap locked down.  the reference count could have
-	 * changed while we were in malloc.  if the reference count
+	 * changed while we were allocating.  if the reference count
 	 * dropped down to one we take over the old map rather than
 	 * copying the amap.
 	 */
@@ -1587,4 +1592,3 @@
 
 	UVMHIST_LOG(maphist,"<- done!", 0, 0, 0, 0);
 }
-

Index: src/sys/uvm/uvm_amap.h
diff -u src/sys/uvm/uvm_amap.h:1.35 src/sys/uvm/uvm_amap.h:1.36
--- src/sys/uvm/uvm_amap.h:1.35	Wed Feb  2 15:13:33 2011
+++ src/sys/uvm/uvm_amap.h	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_amap.h,v 1.35 2011/02/02 15:13:33 chuck Exp $	*/
+/*	$NetBSD: uvm_amap.h,v 1.36 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -208,7 +208,7 @@
  * of this VM is actually used.  since the stack is anonymous memory
  * it makes sense for it to live in an amap, but if we allocated an
  * amap for the entire stack range we could end up wasting a large
- * amount of malloc'd KVM.
+ * amount of allocated KVM.
  *
  * for example, on the i386 at boot time we allocate two amaps for the stack
  * of /sbin/init:

Index: src/sys/uvm/uvm_anon.c
diff -u src/sys/uvm/uvm_anon.c:1.52 src/sys/uvm/uvm_anon.c:1.53
--- src/sys/uvm/uvm_anon.c:1.52	Wed Feb  2 15:13:34 2011
+++ src/sys/uvm/uvm_anon.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_anon.c,v 1.52 2011/02/02 15:13:34 chuck Exp $	*/
+/*	$NetBSD: uvm_anon.c,v 1.53 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -30,14 +30,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.52 2011/02/02 15:13:34 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.53 2011/04/23 18:14:12 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
 #include <sys/pool.h>
 #include <sys/kernel.h>
 

Index: src/sys/uvm/uvm_aobj.c
diff -u src/sys/uvm/uvm_aobj.c:1.113 src/sys/uvm/uvm_aobj.c:1.114
--- src/sys/uvm/uvm_aobj.c:1.113	Fri Feb 11 00:21:18 2011
+++ src/sys/uvm/uvm_aobj.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_aobj.c,v 1.113 2011/02/11 00:21:18 rmind Exp $	*/
+/*	$NetBSD: uvm_aobj.c,v 1.114 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.113 2011/02/11 00:21:18 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.114 2011/04/23 18:14:12 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -442,7 +442,7 @@
 	int refs;
 
 	/*
-	 * malloc a new aobj unless we are asked for the kernel object
+	 * Allocate a new aobj, unless kernel object is requested.
 	 */
 
 	if (flags & UAO_FLAG_KERNOBJ) {
@@ -486,7 +486,7 @@
 			aobj->u_swslots = kmem_zalloc(pages * sizeof(int),
 			    kernswap ? KM_NOSLEEP : KM_SLEEP);
 			if (aobj->u_swslots == NULL)
-				panic("uao_create: malloc swslots failed");
+				panic("uao_create: swslots allocation failed");
 		}
 #endif /* defined(VMSWAP) */
 

Index: src/sys/uvm/uvm_device.c
diff -u src/sys/uvm/uvm_device.c:1.60 src/sys/uvm/uvm_device.c:1.61
--- src/sys/uvm/uvm_device.c:1.60	Sat Feb 12 14:45:31 2011
+++ src/sys/uvm/uvm_device.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_device.c,v 1.60 2011/02/12 14:45:31 jmcneill Exp $	*/
+/*	$NetBSD: uvm_device.c,v 1.61 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.60 2011/02/12 14:45:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.61 2011/04/23 18:14:12 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -210,7 +210,7 @@
 		}
 
 		/*
-		 * did not find it on main list.   need to malloc a new one.
+		 * Did not find it on main list.  Need to allocate a new one.
 		 */
 
 		mutex_exit(&udv_lock);
Index: src/sys/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.60 src/sys/uvm/uvm_pglist.c:1.61
--- src/sys/uvm/uvm_pglist.c:1.60	Wed Jan 26 08:49:48 2011
+++ src/sys/uvm/uvm_pglist.c	Sat Apr 23 18:14:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.60 2011/01/26 08:49:48 enami Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.61 2011/04/23 18:14:13 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -35,12 +35,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.60 2011/01/26 08:49:48 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.61 2011/04/23 18:14:13 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
 
 #include <uvm/uvm.h>
 #include <uvm/uvm_pdpolicy.h>

Index: src/sys/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.171 src/sys/uvm/uvm_extern.h:1.172
--- src/sys/uvm/uvm_extern.h:1.171	Thu Feb 17 19:27:13 2011
+++ src/sys/uvm/uvm_extern.h	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.171 2011/02/17 19:27:13 matt Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.172 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -135,7 +135,7 @@
 #define UVM_FLAG_OVERLAY 0x020000 /* establish overlay */
 #define UVM_FLAG_NOMERGE 0x040000 /* don't merge map entries */
 #define UVM_FLAG_COPYONW 0x080000 /* set copy_on_write flag */
-#define UVM_FLAG_AMAPPAD 0x100000 /* for bss: pad amap to reduce malloc() */
+#define UVM_FLAG_AMAPPAD 0x100000 /* for bss: pad amap to reduce allocations */
 #define UVM_FLAG_TRYLOCK 0x200000 /* fail if we can not lock map */
 #define UVM_FLAG_NOWAIT  0x400000 /* not allowed to sleep */
 #define UVM_FLAG_QUANTUM 0x800000 /* entry can never be split later */

Index: src/sys/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.183 src/sys/uvm/uvm_fault.c:1.184
--- src/sys/uvm/uvm_fault.c:1.183	Fri Apr  8 10:42:51 2011
+++ src/sys/uvm/uvm_fault.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.183 2011/04/08 10:42:51 yamt Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.184 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,15 +32,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.183 2011/04/08 10:42:51 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.184 2011/04/23 18:14:12 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
 #include <sys/mman.h>
 
 #include <uvm/uvm.h>

Index: src/sys/uvm/uvm_init.c
diff -u src/sys/uvm/uvm_init.c:1.39 src/sys/uvm/uvm_init.c:1.40
--- src/sys/uvm/uvm_init.c:1.39	Wed Feb  2 15:13:34 2011
+++ src/sys/uvm/uvm_init.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_init.c,v 1.39 2011/02/02 15:13:34 chuck Exp $	*/
+/*	$NetBSD: uvm_init.c,v 1.40 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_init.c,v 1.39 2011/02/02 15:13:34 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_init.c,v 1.40 2011/04/23 18:14:12 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -42,8 +42,6 @@
 #include <sys/resourcevar.h>
 #include <sys/kmem.h>
 #include <sys/mman.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
 #include <sys/vnode.h>
 
 #include <uvm/uvm.h>

Index: src/sys/uvm/uvm_io.c
diff -u src/sys/uvm/uvm_io.c:1.25 src/sys/uvm/uvm_io.c:1.26
--- src/sys/uvm/uvm_io.c:1.25	Wed Feb  2 15:13:34 2011
+++ src/sys/uvm/uvm_io.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_io.c,v 1.25 2011/02/02 15:13:34 chuck Exp $	*/
+/*	$NetBSD: uvm_io.c,v 1.26 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,13 +32,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_io.c,v 1.25 2011/02/02 15:13:34 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_io.c,v 1.26 2011/04/23 18:14:12 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mman.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
 #include <sys/uio.h>
 
 #include <uvm/uvm.h>

Index: src/sys/uvm/uvm_kmguard.c
diff -u src/sys/uvm/uvm_kmguard.c:1.4 src/sys/uvm/uvm_kmguard.c:1.5
--- src/sys/uvm/uvm_kmguard.c:1.4	Tue Nov  2 20:49:48 2010
+++ src/sys/uvm/uvm_kmguard.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_kmguard.c,v 1.4 2010/11/02 20:49:48 skrll Exp $	*/
+/*	$NetBSD: uvm_kmguard.c,v 1.5 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -38,12 +38,10 @@
  * - Use-after-free
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_kmguard.c,v 1.4 2010/11/02 20:49:48 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_kmguard.c,v 1.5 2011/04/23 18:14:12 rmind Exp $");
 
 #include <sys/param.h>
-#include <sys/malloc.h>
 #include <sys/systm.h>
-#include <sys/proc.h>
 #include <sys/pool.h>
 #include <sys/atomic.h>
 

Index: src/sys/uvm/uvm_loan.c
diff -u src/sys/uvm/uvm_loan.c:1.78 src/sys/uvm/uvm_loan.c:1.79
--- src/sys/uvm/uvm_loan.c:1.78	Wed Feb  2 15:13:34 2011
+++ src/sys/uvm/uvm_loan.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_loan.c,v 1.78 2011/02/02 15:13:34 chuck Exp $	*/
+/*	$NetBSD: uvm_loan.c,v 1.79 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,13 +32,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.78 2011/02/02 15:13:34 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.79 2011/04/23 18:14:12 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
 #include <sys/mman.h>
 
 #include <uvm/uvm.h>

Index: src/sys/uvm/uvm_mmap.c
diff -u src/sys/uvm/uvm_mmap.c:1.134 src/sys/uvm/uvm_mmap.c:1.135
--- src/sys/uvm/uvm_mmap.c:1.134	Wed Feb  2 20:07:25 2011
+++ src/sys/uvm/uvm_mmap.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_mmap.c,v 1.134 2011/02/02 20:07:25 chuck Exp $	*/
+/*	$NetBSD: uvm_mmap.c,v 1.135 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.134 2011/02/02 20:07:25 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.135 2011/04/23 18:14:12 rmind Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_pax.h"
@@ -59,8 +59,6 @@
 #include <sys/resourcevar.h>
 #include <sys/mman.h>
 #include <sys/mount.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
 #include <sys/vnode.h>
 #include <sys/conf.h>
 #include <sys/stat.h>

Index: src/sys/uvm/uvm_pager.c
diff -u src/sys/uvm/uvm_pager.c:1.99 src/sys/uvm/uvm_pager.c:1.100
--- src/sys/uvm/uvm_pager.c:1.99	Wed Feb  2 15:13:34 2011
+++ src/sys/uvm/uvm_pager.c	Sat Apr 23 18:14:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pager.c,v 1.99 2011/02/02 15:13:34 chuck Exp $	*/
+/*	$NetBSD: uvm_pager.c,v 1.100 2011/04/23 18:14:12 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.99 2011/02/02 15:13:34 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.100 2011/04/23 18:14:12 rmind Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
@@ -40,8 +40,6 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
 #include <sys/vnode.h>
 #include <sys/buf.h>
 

Index: src/sys/uvm/uvm_stat.h
diff -u src/sys/uvm/uvm_stat.h:1.48 src/sys/uvm/uvm_stat.h:1.49
--- src/sys/uvm/uvm_stat.h:1.48	Wed Feb  2 15:13:34 2011
+++ src/sys/uvm/uvm_stat.h	Sat Apr 23 18:14:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_stat.h,v 1.48 2011/02/02 15:13:34 chuck Exp $	*/
+/*	$NetBSD: uvm_stat.h,v 1.49 2011/04/23 18:14:13 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -37,7 +37,6 @@
 #include <sys/queue.h>
 #ifdef UVMHIST
 #include <sys/cpu.h>
-#include <sys/malloc.h>
 #endif
 
 /*
@@ -65,7 +64,7 @@
 	LIST_ENTRY(uvm_history) list;	/* link on list of all histories */
 	unsigned int n;			/* number of entries */
 	unsigned int f;			/* next free one */
-	struct uvm_history_ent *e;	/* the malloc'd entries */
+	struct uvm_history_ent *e;	/* the allocated entries */
 };
 
 LIST_HEAD(uvm_history_head, uvm_history);
@@ -102,6 +101,7 @@
 #else
 #include <sys/kernel.h>		/* for "cold" variable */
 #include <sys/atomic.h>
+#include <sys/kmem.h>
 
 extern	struct uvm_history_head uvm_histories;
 
@@ -114,9 +114,7 @@
 	(NAME).n = (N); \
 	(NAME).f = 0; \
 	(NAME).e = (struct uvm_history_ent *) \
-		malloc(sizeof(struct uvm_history_ent) * (N), M_TEMP, \
-		    M_WAITOK); \
-	memset((NAME).e, 0, sizeof(struct uvm_history_ent) * (N)); \
+		kmem_zalloc(sizeof(struct uvm_history_ent) * (N), KM_SLEEP); \
 	LIST_INSERT_HEAD(&uvm_histories, &(NAME), list); \
 } while (/*CONSTCOND*/ 0)
 

Index: src/sys/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.153 src/sys/uvm/uvm_swap.c:1.154
--- src/sys/uvm/uvm_swap.c:1.153	Fri Nov 19 06:44:47 2010
+++ src/sys/uvm/uvm_swap.c	Sat Apr 23 18:14:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.153 2010/11/19 06:44:47 dholland Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.154 2011/04/23 18:14:13 rmind Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.153 2010/11/19 06:44:47 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.154 2011/04/23 18:14:13 rmind Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -307,9 +307,9 @@
  * swaplist_insert: insert swap device "sdp" into the global list
  *
  * => caller must hold both swap_syscall_lock and uvm_swap_data_lock
- * => caller must provide a newly malloc'd swappri structure (we will
- *	FREE it if we don't need it... this it to prevent malloc blocking
- *	here while adding swap)
+ * => caller must provide a newly allocated swappri structure (we will
+ *	FREE it if we don't need it... this it to prevent allocation
+ *	blocking here while adding swap)
  */
 static void
 swaplist_insert(struct swapdev *sdp, struct swappri *newspp, int priority)

Index: src/sys/uvm/uvm_vnode.c
diff -u src/sys/uvm/uvm_vnode.c:1.94 src/sys/uvm/uvm_vnode.c:1.95
--- src/sys/uvm/uvm_vnode.c:1.94	Wed Feb  2 20:07:25 2011
+++ src/sys/uvm/uvm_vnode.c	Sat Apr 23 18:14:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_vnode.c,v 1.94 2011/02/02 20:07:25 chuck Exp $	*/
+/*	$NetBSD: uvm_vnode.c,v 1.95 2011/04/23 18:14:13 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,15 +45,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.94 2011/02/02 20:07:25 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.95 2011/04/23 18:14:13 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
 #include <sys/vnode.h>
 #include <sys/disklabel.h>
 #include <sys/ioctl.h>

Reply via email to