Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Replace malloc with kmem, and remove M_SUBPROC.
details: https://anonhg.NetBSD.org/src/rev/08872f25e386
branches: trunk
changeset: 764363:08872f25e386
user: rmind <rmind%NetBSD.org@localhost>
date: Mon Apr 18 00:26:11 2011 +0000
description:
Replace malloc with kmem, and remove M_SUBPROC.
diffstat:
sys/arch/sparc/sparc/machdep.c | 6 +++---
sys/arch/sparc/sparc/trap.c | 7 +++----
sys/arch/sparc/sparc/vm_machdep.c | 13 ++++++-------
sys/kern/kern_proc.c | 5 ++---
sys/sys/proc.h | 3 +--
5 files changed, 15 insertions(+), 19 deletions(-)
diffs (156 lines):
diff -r a038e9cb599c -r 08872f25e386 sys/arch/sparc/sparc/machdep.c
--- a/sys/arch/sparc/sparc/machdep.c Sun Apr 17 23:54:05 2011 +0000
+++ b/sys/arch/sparc/sparc/machdep.c Mon Apr 18 00:26:11 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.307 2011/03/04 22:25:28 joerg Exp $ */
+/* $NetBSD: machdep.c,v 1.308 2011/04/18 00:26:11 rmind Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.307 2011/03/04 22:25:28 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.308 2011/04/18 00:26:11 rmind Exp $");
#include "opt_compat_netbsd.h"
#include "opt_compat_sunos.h"
@@ -383,7 +383,7 @@
}
l->l_md.md_fpu = NULL;
FPU_UNLOCK(s);
- free((void *)fs, M_SUBPROC);
+ kmem_free(fs, sizeof(struct fpstate));
l->l_md.md_fpstate = NULL;
}
memset((void *)tf, 0, sizeof *tf);
diff -r a038e9cb599c -r 08872f25e386 sys/arch/sparc/sparc/trap.c
--- a/sys/arch/sparc/sparc/trap.c Sun Apr 17 23:54:05 2011 +0000
+++ b/sys/arch/sparc/sparc/trap.c Mon Apr 18 00:26:11 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.186 2011/01/14 02:06:31 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.187 2011/04/18 00:26:12 rmind Exp $ */
/*
* Copyright (c) 1996
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.186 2011/01/14 02:06:31 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.187 2011/04/18 00:26:12 rmind Exp $");
#include "opt_ddb.h"
#include "opt_compat_svr4.h"
@@ -61,7 +61,6 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
#include <sys/kmem.h>
#include <sys/resource.h>
#include <sys/signal.h>
@@ -419,7 +418,7 @@
#endif
if (fs == NULL) {
- fs = malloc(sizeof *fs, M_SUBPROC, M_WAITOK);
+ fs = kmem_alloc(sizeof(struct fpstate), KM_SLEEP);
*fs = initfpstate;
l->l_md.md_fpstate = fs;
}
diff -r a038e9cb599c -r 08872f25e386 sys/arch/sparc/sparc/vm_machdep.c
--- a/sys/arch/sparc/sparc/vm_machdep.c Sun Apr 17 23:54:05 2011 +0000
+++ b/sys/arch/sparc/sparc/vm_machdep.c Mon Apr 18 00:26:11 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.105 2011/02/24 04:28:48 joerg Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.106 2011/04/18 00:26:12 rmind Exp $ */
/*
* Copyright (c) 1996
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.105 2011/02/24 04:28:48 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.106 2011/04/18 00:26:12 rmind Exp $");
#include "opt_multiprocessor.h"
@@ -57,11 +57,10 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/core.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/buf.h>
#include <sys/exec.h>
#include <sys/vnode.h>
-#include <sys/simplelock.h>
#include <sys/cpu.h>
#include <uvm/uvm_extern.h>
@@ -220,8 +219,8 @@
struct cpu_info *cpi;
int s;
- l2->l_md.md_fpstate = malloc(sizeof(struct fpstate),
- M_SUBPROC, M_WAITOK);
+ l2->l_md.md_fpstate =
+ kmem_alloc(sizeof(struct fpstate), KM_SLEEP);
FPU_LOCK(s);
if ((cpi = l1->l_md.md_fpu) != NULL) {
@@ -325,7 +324,7 @@
struct fpstate *fs;
if ((fs = l->l_md.md_fpstate) != NULL)
- free((void *)fs, M_SUBPROC);
+ kmem_free(fs, sizeof(struct fpstate));
}
void
diff -r a038e9cb599c -r 08872f25e386 sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c Sun Apr 17 23:54:05 2011 +0000
+++ b/sys/kern/kern_proc.c Mon Apr 18 00:26:11 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_proc.c,v 1.174 2011/04/05 09:02:23 rmind Exp $ */
+/* $NetBSD: kern_proc.c,v 1.175 2011/04/18 00:26:11 rmind Exp $ */
/*-
* Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.174 2011/04/05 09:02:23 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.175 2011/04/18 00:26:11 rmind Exp $");
#ifdef _KERNEL_OPT
#include "opt_kstack.h"
@@ -205,7 +205,6 @@
int cmask = CMASK;
MALLOC_DEFINE(M_EMULDATA, "emuldata", "Per-process emulation data");
-MALLOC_DEFINE(M_SUBPROC, "subproc", "Proc sub-structures");
static int sysctl_doeproc(SYSCTLFN_PROTO);
static int sysctl_kern_proc_args(SYSCTLFN_PROTO);
diff -r a038e9cb599c -r 08872f25e386 sys/sys/proc.h
--- a/sys/sys/proc.h Sun Apr 17 23:54:05 2011 +0000
+++ b/sys/sys/proc.h Mon Apr 18 00:26:11 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.303 2011/04/13 08:45:00 mrg Exp $ */
+/* $NetBSD: proc.h,v 1.304 2011/04/18 00:26:11 rmind Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -413,7 +413,6 @@
#ifdef _KERNEL
#include <sys/mallocvar.h>
MALLOC_DECLARE(M_EMULDATA);
-MALLOC_DECLARE(M_SUBPROC); /* XXX - only used by sparc/sparc64 */
/*
* We use process IDs <= PID_MAX until there are > 16k processes.
Home |
Main Index |
Thread Index |
Old Index