From 75cd31da1a0f264658261d0a7aba581b4bff459e Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Fri, 23 Mar 2001 18:42:07 +0000 Subject: Use pool to allocate processes. --- sys/kern/kern_exit.c | 5 +++-- sys/kern/kern_fork.c | 5 +++-- sys/kern/kern_proc.c | 8 +++++++- sys/sys/proc.h | 4 +++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 96c19a5d6ed..575394f72ae 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.28 2000/11/16 20:02:16 provos Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.29 2001/03/23 18:42:06 art Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -64,6 +64,7 @@ #include #include #include +#include #ifdef SYSVSHM #include #endif @@ -547,7 +548,7 @@ proc_zap(p) if (p->p_textvp) vrele(p->p_textvp); - FREE(p, M_PROC); + pool_put(&proc_pool, p); nprocs--; } diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index e7fbaae0a56..3179f7b07ae 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.37 2001/02/13 21:00:48 art Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.38 2001/03/23 18:42:06 art Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -56,6 +56,7 @@ #include #include #include +#include #include @@ -195,7 +196,7 @@ fork1(p1, flags, stack, stacksize, retval) return ENOMEM; /* Allocate new proc. */ - MALLOC(newproc, struct proc *, sizeof(struct proc), M_PROC, M_WAITOK); + newproc = pool_get(&proc_pool, PR_WAITOK); lastpid++; if (randompid) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index b8bfac34f4d..5752a4936f7 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_proc.c,v 1.7 2000/06/05 11:02:50 art Exp $ */ +/* $OpenBSD: kern_proc.c,v 1.8 2001/03/23 18:42:06 art Exp $ */ /* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */ /* @@ -52,6 +52,7 @@ #include #include #include +#include /* * Structure associated with user cacheing. @@ -75,6 +76,8 @@ u_long pgrphash; struct proclist allproc; struct proclist zombproc; +struct pool proc_pool; + /* * Locking of this proclist is special; it's accessed in a * critical section of process exit, and thus locking it can't @@ -106,6 +109,9 @@ procinit() pidhashtbl = hashinit(maxproc / 4, M_PROC, M_WAITOK, &pidhash); pgrphashtbl = hashinit(maxproc / 4, M_PROC, M_WAITOK, &pgrphash); uihashtbl = hashinit(maxproc / 16, M_PROC, M_WAITOK, &uihash); + + pool_init(&proc_pool, sizeof(struct proc), 0, 0, 0, "procpl", + 0, pool_page_alloc_nointr, pool_page_free_nointr, M_PROC); } /* diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 9a2efd52484..2b8b5293b81 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.37 2001/03/03 11:50:56 art Exp $ */ +/* $OpenBSD: proc.h,v 1.38 2001/03/23 18:42:06 art Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -340,6 +340,8 @@ extern struct simplelock deadproc_slock; extern struct proc *initproc; /* Process slots for init, pager. */ extern struct proc *syncerproc; /* filesystem syncer daemon */ +extern struct pool proc_pool; /* memory pool for procs */ + #define NQS 32 /* 32 run queues. */ int whichqs; /* Bit mask summary of non-empty Q's. */ struct prochd { -- cgit v1.2.3