From 9532ab7116a36e60ae15ec463c757a7d2e7f9b39 Mon Sep 17 00:00:00 2001 From: green Date: Mon, 2 Aug 2004 00:18:36 +0000 Subject: * Add a "how" argument to uma_zone constructors and initialization functions so that they know whether the allocation is supposed to be able to sleep or not. * Allow uma_zone constructors and initialation functions to return either success or error. Almost all of the ones in the tree currently return success unconditionally, but mbuf is a notable exception: the packet zone constructor wants to be able to fail if it cannot suballocate an mbuf cluster, and the mbuf allocators want to be able to fail in general in a MAC kernel if the MAC mbuf initializer fails. This fixes the panics people are seeing when they run out of memory for mbuf clusters. * Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing the default. Both bmilekic and jeff have reviewed the changes made to make failable zone allocations work. --- sys/kern/kern_proc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sys/kern/kern_proc.c') diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index a83b9e1..a104ae4 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -74,9 +74,9 @@ static void doenterpgrp(struct proc *, struct pgrp *); static void orphanpg(struct pgrp *pg); static void pgadjustjobc(struct pgrp *pgrp, int entering); static void pgdelete(struct pgrp *); -static void proc_ctor(void *mem, int size, void *arg); +static int proc_ctor(void *mem, int size, void *arg, int flags); static void proc_dtor(void *mem, int size, void *arg); -static void proc_init(void *mem, int size); +static int proc_init(void *mem, int size, int flags); static void proc_fini(void *mem, int size); /* @@ -128,12 +128,13 @@ procinit() /* * Prepare a proc for use. */ -static void -proc_ctor(void *mem, int size, void *arg) +static int +proc_ctor(void *mem, int size, void *arg, int flags) { struct proc *p; p = (struct proc *)mem; + return (0); } /* @@ -178,8 +179,8 @@ proc_dtor(void *mem, int size, void *arg) /* * Initialize type-stable parts of a proc (when newly created). */ -static void -proc_init(void *mem, int size) +static int +proc_init(void *mem, int size, int flags) { struct proc *p; struct thread *td; @@ -195,6 +196,7 @@ proc_init(void *mem, int size) proc_linkup(p, kg, ke, td); bzero(&p->p_mtx, sizeof(struct mtx)); mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK); + return (0); } /* -- cgit v1.1