From owner-p4-projects@FreeBSD.ORG Fri Feb 3 21:35:17 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DB39016A423; Fri, 3 Feb 2006 21:35:16 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B60A716A420 for ; Fri, 3 Feb 2006 21:35:16 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 774BA43D45 for ; Fri, 3 Feb 2006 21:35:16 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k13LZGR9041407 for ; Fri, 3 Feb 2006 21:35:16 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k13LZGGX041404 for perforce@freebsd.org; Fri, 3 Feb 2006 21:35:16 GMT (envelope-from jhb@freebsd.org) Date: Fri, 3 Feb 2006 21:35:16 GMT Message-Id: <200602032135.k13LZGGX041404@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 90998 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2006 21:35:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=90998 Change 90998 by jhb@jhb_slimer on 2006/02/03 21:34:55 Block in exit1() until all holds on a process are released. Affected files ... .. //depot/projects/smpng/sys/kern/kern_exit.c#109 edit .. //depot/projects/smpng/sys/sys/proc.h#161 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_exit.c#109 (text+ko) ==== @@ -175,6 +175,13 @@ p->p_flag |= P_WEXIT; + /* + * Wait for any processes that have a hold on our vmspace to + * release their reference. + */ + while (p->p_lock > 0) + msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0); + PROC_LOCK(p->p_pptr); sigqueue_take(p->p_ksi); PROC_UNLOCK(p->p_pptr); ==== //depot/projects/smpng/sys/sys/proc.h#161 (text+ko) ==== @@ -785,6 +785,7 @@ } while (0) #define _PHOLD(p) do { \ PROC_LOCK_ASSERT((p), MA_OWNED); \ + KASSERT(!((p)->p_flag & P_WEXIT), ("PHOLD of exiting process"));\ (p)->p_lock++; \ if (((p)->p_sflag & PS_INMEM) == 0) \ faultin((p)); \ @@ -798,6 +799,8 @@ #define _PRELE(p) do { \ PROC_LOCK_ASSERT((p), MA_OWNED); \ (--(p)->p_lock); \ + if (((p)->p_flag & P_WEXIT) && (p)->p_lock == 0) \ + wakeup(&(p)->p_lock); \ } while (0) /* Check whether a thread is safe to be swapped out. */