From 101b936bbcbf5df4649ff52f53a4e12fc2b27ef1 Mon Sep 17 00:00:00 2001 From: tanimura Date: Fri, 3 May 2002 07:46:59 +0000 Subject: As malloc(9) and free(9) are now Giant-free, remove the Giant lock across malloc(9) and free(9) of a pgrp or a session. --- sys/kern/kern_prot.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'sys/kern/kern_prot.c') diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 30f8902..e4f9d3a 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -344,10 +344,8 @@ setsid(register struct thread *td, struct setsid_args *uap) error = 0; pgrp = NULL; - mtx_lock(&Giant); MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO); - mtx_unlock(&Giant); sx_xlock(&proctree_lock); @@ -364,14 +362,10 @@ setsid(register struct thread *td, struct setsid_args *uap) sx_xunlock(&proctree_lock); - if (newpgrp != NULL || newsess != NULL) { - mtx_lock(&Giant); - if (newpgrp != NULL) - FREE(newpgrp, M_PGRP); - if (newsess != NULL) - FREE(newsess, M_SESSION); - mtx_unlock(&Giant); - } + if (newpgrp != NULL) + FREE(newpgrp, M_PGRP); + if (newsess != NULL) + FREE(newsess, M_SESSION); return (error); } @@ -413,9 +407,7 @@ setpgid(struct thread *td, register struct setpgid_args *uap) error = 0; - mtx_lock(&Giant); MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); - mtx_unlock(&Giant); sx_xlock(&proctree_lock); if (uap->pid != 0 && uap->pid != curp->p_pid) { @@ -479,11 +471,8 @@ done: sx_xunlock(&proctree_lock); KASSERT((error == 0) || (newpgrp != NULL), ("setpgid failed and newpgrp is NULL")); - if (newpgrp != NULL) { - mtx_lock(&Giant); + if (newpgrp != NULL) FREE(newpgrp, M_PGRP); - mtx_unlock(&Giant); - } return (error); } -- cgit v1.1