Use a pool for proc structures.
This commit is contained in:
parent
6f739e1a66
commit
0e28b643e9
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: svr4_misc.c,v 1.60 1998/03/03 13:45:58 fvdl Exp $ */
|
/* $NetBSD: svr4_misc.c,v 1.61 1998/08/02 04:41:33 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994 Christos Zoulas
|
* Copyright (c) 1994 Christos Zoulas
|
||||||
|
@ -48,6 +48,7 @@
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
|
#include <sys/pool.h>
|
||||||
#include <sys/mbuf.h>
|
#include <sys/mbuf.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
|
@ -1306,7 +1307,7 @@ loop:
|
||||||
* release while still running in process context.
|
* release while still running in process context.
|
||||||
*/
|
*/
|
||||||
cpu_wait(q);
|
cpu_wait(q);
|
||||||
FREE(q, M_PROC);
|
pool_put(&proc_pool, q);
|
||||||
nprocs--;
|
nprocs--;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: kern_exit.c,v 1.52 1998/07/31 22:50:49 perry Exp $ */
|
/* $NetBSD: kern_exit.c,v 1.53 1998/08/02 04:41:32 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||||
|
@ -60,6 +60,7 @@
|
||||||
#include <sys/vnode.h>
|
#include <sys/vnode.h>
|
||||||
#include <sys/syslog.h>
|
#include <sys/syslog.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
|
#include <sys/pool.h>
|
||||||
#include <sys/resourcevar.h>
|
#include <sys/resourcevar.h>
|
||||||
#include <sys/ptrace.h>
|
#include <sys/ptrace.h>
|
||||||
#include <sys/acct.h>
|
#include <sys/acct.h>
|
||||||
|
@ -381,7 +382,7 @@ loop:
|
||||||
* release while still running in process context.
|
* release while still running in process context.
|
||||||
*/
|
*/
|
||||||
cpu_wait(p);
|
cpu_wait(p);
|
||||||
FREE(p, M_PROC);
|
pool_put(&proc_pool, p);
|
||||||
nprocs--;
|
nprocs--;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: kern_fork.c,v 1.43 1998/06/25 21:17:16 thorpej Exp $ */
|
/* $NetBSD: kern_fork.c,v 1.44 1998/08/02 04:41:32 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||||
|
@ -49,6 +49,7 @@
|
||||||
#include <sys/filedesc.h>
|
#include <sys/filedesc.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
|
#include <sys/pool.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/resourcevar.h>
|
#include <sys/resourcevar.h>
|
||||||
|
@ -169,7 +170,7 @@ fork1(p1, flags, retval, rnewprocp)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Allocate new proc. */
|
/* Allocate new proc. */
|
||||||
MALLOC(newproc, struct proc *, sizeof(struct proc), M_PROC, M_WAITOK);
|
newproc = pool_get(&proc_pool, PR_WAITOK);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find an unused process ID. We remember a range of unused IDs
|
* Find an unused process ID. We remember a range of unused IDs
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: kern_proc.c,v 1.23 1998/03/01 02:22:29 fvdl Exp $ */
|
/* $NetBSD: kern_proc.c,v 1.24 1998/08/02 04:41:32 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||||
|
@ -47,6 +47,7 @@
|
||||||
#include <ufs/ufs/quota.h>
|
#include <ufs/ufs/quota.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
|
#include <sys/pool.h>
|
||||||
#include <sys/mbuf.h>
|
#include <sys/mbuf.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/tty.h>
|
#include <sys/tty.h>
|
||||||
|
@ -73,6 +74,7 @@ struct pgrphashhead *pgrphashtbl;
|
||||||
u_long pgrphash;
|
u_long pgrphash;
|
||||||
struct proclist allproc;
|
struct proclist allproc;
|
||||||
struct proclist zombproc;
|
struct proclist zombproc;
|
||||||
|
struct pool proc_pool;
|
||||||
|
|
||||||
static void orphanpg __P((struct pgrp *));
|
static void orphanpg __P((struct pgrp *));
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -91,6 +93,8 @@ procinit()
|
||||||
pidhashtbl = hashinit(maxproc / 4, M_PROC, M_WAITOK, &pidhash);
|
pidhashtbl = hashinit(maxproc / 4, M_PROC, M_WAITOK, &pidhash);
|
||||||
pgrphashtbl = hashinit(maxproc / 4, M_PROC, M_WAITOK, &pgrphash);
|
pgrphashtbl = hashinit(maxproc / 4, M_PROC, M_WAITOK, &pgrphash);
|
||||||
uihashtbl = hashinit(maxproc / 16, M_PROC, M_WAITOK, &uihash);
|
uihashtbl = hashinit(maxproc / 16, M_PROC, M_WAITOK, &uihash);
|
||||||
|
pool_init(&proc_pool, sizeof(struct proc), 0, 0, 0, "procpl",
|
||||||
|
0, NULL, NULL, M_PROC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: proc.h,v 1.60 1998/05/02 18:41:47 christos Exp $ */
|
/* $NetBSD: proc.h,v 1.61 1998/08/02 04:41:32 thorpej Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1986, 1989, 1991, 1993
|
* Copyright (c) 1986, 1989, 1991, 1993
|
||||||
|
@ -303,6 +303,8 @@ extern struct proclist allproc; /* List of all processes. */
|
||||||
extern struct proclist zombproc; /* List of zombie processes. */
|
extern struct proclist zombproc; /* List of zombie processes. */
|
||||||
struct proc *initproc; /* Process slots for init, pager. */
|
struct proc *initproc; /* Process slots for init, pager. */
|
||||||
|
|
||||||
|
extern struct pool proc_pool; /* memory pool for procs */
|
||||||
|
|
||||||
#define NQS 32 /* 32 run queues. */
|
#define NQS 32 /* 32 run queues. */
|
||||||
int whichqs; /* Bit mask summary of non-empty Q's. */
|
int whichqs; /* Bit mask summary of non-empty Q's. */
|
||||||
struct prochd {
|
struct prochd {
|
||||||
|
|
Loading…
Reference in New Issue