summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-09-07 15:00:21 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-09-07 15:00:21 +0000
commit85ce33f47337d8ae2200b69c865bad9704a53564 (patch)
tree45c03da13cdd18d57180b1614667ab28a7a26012 /sys/uvm
parent27eb8946aec561bdd8abb9e09db43d6f4093d59a (diff)
Use M_ZERO in a few more places to shave bytes from the kernel.
eyeballed and ok dlg@
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_amap.c5
-rw-r--r--sys/uvm/uvm_aobj.c5
-rw-r--r--sys/uvm/uvm_stat.h5
-rw-r--r--sys/uvm/uvm_swap.c15
4 files changed, 12 insertions, 18 deletions
diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c
index ee105ed3b13..a3f74b64019 100644
--- a/sys/uvm/uvm_amap.c
+++ b/sys/uvm/uvm_amap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_amap.c,v 1.39 2007/06/18 21:51:15 pedro Exp $ */
+/* $OpenBSD: uvm_amap.c,v 1.40 2007/09/07 15:00:20 art Exp $ */
/* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */
/*
@@ -902,7 +902,7 @@ amap_pp_establish(struct vm_amap *amap)
{
amap->am_ppref = malloc(sizeof(int) * amap->am_maxslot,
- M_UVMAMAP, M_NOWAIT);
+ M_UVMAMAP, M_NOWAIT|M_ZERO);
/*
* if we fail then we just won't use ppref for this amap
@@ -915,7 +915,6 @@ amap_pp_establish(struct vm_amap *amap)
/*
* init ppref
*/
- memset(amap->am_ppref, 0, sizeof(int) * amap->am_maxslot);
pp_setreflen(amap->am_ppref, 0, amap->am_ref, amap->am_nslot);
}
diff --git a/sys/uvm/uvm_aobj.c b/sys/uvm/uvm_aobj.c
index 08910778cc1..74a087ab512 100644
--- a/sys/uvm/uvm_aobj.c
+++ b/sys/uvm/uvm_aobj.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_aobj.c,v 1.34 2007/04/13 18:57:49 art Exp $ */
+/* $OpenBSD: uvm_aobj.c,v 1.35 2007/09/07 15:00:20 art Exp $ */
/* $NetBSD: uvm_aobj.c,v 1.39 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -524,10 +524,9 @@ uao_create(size, flags)
panic("uao_create: hashinit swhash failed");
} else {
aobj->u_swslots = malloc(pages * sizeof(int),
- M_UVMAOBJ, mflags);
+ M_UVMAOBJ, mflags|M_ZERO);
if (aobj->u_swslots == NULL)
panic("uao_create: malloc swslots failed");
- memset(aobj->u_swslots, 0, pages * sizeof(int));
}
if (flags) {
diff --git a/sys/uvm/uvm_stat.h b/sys/uvm/uvm_stat.h
index 7aecd0de5b5..8452948a188 100644
--- a/sys/uvm/uvm_stat.h
+++ b/sys/uvm/uvm_stat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_stat.h,v 1.14 2006/01/16 13:11:06 mickey Exp $ */
+/* $OpenBSD: uvm_stat.h,v 1.15 2007/09/07 15:00:20 art Exp $ */
/* $NetBSD: uvm_stat.h,v 1.19 2001/02/04 10:55:58 mrg Exp $ */
/*
@@ -162,8 +162,7 @@ do { \
simple_lock_init(&(NAME).l); \
(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)); \
+ M_WAITOK|M_ZERO); \
LIST_INSERT_HEAD(&uvm_histories, &(NAME), list); \
} while (0)
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index f5baa906794..eea4bf6717c 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_swap.c,v 1.72 2007/06/18 21:51:15 pedro Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.73 2007/09/07 15:00:20 art Exp $ */
/* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */
/*
@@ -344,11 +344,10 @@ uvm_swap_initcrypt(struct swapdev *sdp, int npages)
* we may not call malloc with M_WAITOK. This consumes only
* 8KB memory for a 256MB swap partition.
*/
- sdp->swd_decrypt = malloc(SWD_DCRYPT_SIZE(npages), M_VMSWAP, M_WAITOK);
- memset(sdp->swd_decrypt, 0, SWD_DCRYPT_SIZE(npages));
+ sdp->swd_decrypt = malloc(SWD_DCRYPT_SIZE(npages), M_VMSWAP,
+ M_WAITOK|M_ZERO);
sdp->swd_keys = malloc((npages >> SWD_KEY_SHIFT) * sizeof(struct swap_key),
- M_VMSWAP, M_WAITOK);
- memset(sdp->swd_keys, 0, (npages >> SWD_KEY_SHIFT) * sizeof(struct swap_key));
+ M_VMSWAP, M_WAITOK|M_ZERO);
sdp->swd_nkeys = 0;
}
@@ -799,9 +798,8 @@ sys_swapctl(p, v, retval)
simple_unlock(&uvm.swap_data_lock);
break;
}
- sdp = malloc(sizeof *sdp, M_VMSWAP, M_WAITOK);
+ sdp = malloc(sizeof *sdp, M_VMSWAP, M_WAITOK|M_ZERO);
spp = malloc(sizeof *spp, M_VMSWAP, M_WAITOK);
- memset(sdp, 0, sizeof(*sdp));
sdp->swd_flags = SWF_FAKE; /* placeholder only */
sdp->swd_vp = vp;
sdp->swd_dev = (vp->v_type == VBLK) ? vp->v_rdev : NODEV;
@@ -2091,9 +2089,8 @@ swapmount()
return;
}
- sdp = malloc(sizeof(*sdp), M_VMSWAP, M_WAITOK);
+ sdp = malloc(sizeof(*sdp), M_VMSWAP, M_WAITOK|M_ZERO);
spp = malloc(sizeof(*spp), M_VMSWAP, M_WAITOK);
- memset(sdp, 0, sizeof(*sdp));
sdp->swd_flags = SWF_FAKE;
sdp->swd_dev = swap_dev;