Date: Mon, 16 Mar 2015 01:09:50 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280131 - head/sys/kern Message-ID: <201503160109.t2G19oeb050865@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Mon Mar 16 01:09:49 2015 New Revision: 280131 URL: https://svnweb.freebsd.org/changeset/base/280131 Log: proc: get rid of proc lock + unlock pair in proc_reap A comment in the code stated we PROC_LOCK and as a side effect guarantee all writers released process lock. But at that point such lock was already taken while we were removing the process from all lists, so it should be already unreachable. Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Mar 16 00:10:03 2015 (r280130) +++ head/sys/kern/kern_exit.c Mon Mar 16 01:09:49 2015 (r280131) @@ -887,12 +887,13 @@ proc_reap(struct thread *td, struct proc sx_xunlock(&proctree_lock); /* - * As a side effect of this lock, we know that all other writes to - * this proc are visible now, so no more locking is needed for p. + * Removal from allproc list and process group list paired with + * PROC_LOCK which was executed during that time should guarantee + * nothing can reach this process anymore. As such further locking + * is unnecessary. */ - PROC_LOCK(p); p->p_xstat = 0; /* XXX: why? */ - PROC_UNLOCK(p); + PROC_LOCK(q); ruadd(&q->p_stats->p_cru, &q->p_crux, &p->p_ru, &p->p_rux); PROC_UNLOCK(q);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503160109.t2G19oeb050865>