From owner-freebsd-current Tue May 22 6:46:44 2001 Delivered-To: freebsd-current@freebsd.org Received: from rina.r.dl.itc.u-tokyo.ac.jp (cvsup2.r.dl.itc.u-tokyo.ac.jp [133.11.199.247]) by hub.freebsd.org (Postfix) with ESMTP id EE3DC37B422; Tue, 22 May 2001 06:46:40 -0700 (PDT) (envelope-from tanimura@r.dl.itc.u-tokyo.ac.jp) Received: from rina.r.dl.itc.u-tokyo.ac.jp (localhost [127.0.0.1]) by rina.r.dl.itc.u-tokyo.ac.jp (8.11.3+3.4W/3.7W-rina.r-20010412) with ESMTP id f4MDkcD91792 ; Tue, 22 May 2001 22:46:39 +0900 (JST) Message-Id: <200105221346.f4MDkcD91792@rina.r.dl.itc.u-tokyo.ac.jp> Date: Tue, 22 May 2001 22:46:38 +0900 From: Seigo Tanimura To: jhb@FreeBSD.org Cc: tanimura@r.dl.itc.u-tokyo.ac.jp, current@FreeBSD.org Subject: RE: New strategy of locking a process group In-Reply-To: In your message of "Tue, 22 May 2001 21:58:10 +0900" <200105221258.f4MCwAD85296@rina.r.dl.itc.u-tokyo.ac.jp> References: <200105220637.f4M6bDD40713@rina.r.dl.itc.u-tokyo.ac.jp> <200105221258.f4MCwAD85296@rina.r.dl.itc.u-tokyo.ac.jp> User-Agent: Wanderlust/1.1.1 (Purple Rain) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) MULE XEmacs/21.1 (patch 14) (Cuyahoga Valley) (i386--freebsd) Organization: Digital Library Research Division, Information Techinology Centre, The University of Tokyo MIME-Version: 1.0 (generated by SEMI 1.13.7 - "Awazu") Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 22 May 2001 21:58:10 +0900, Seigo Tanimura said: Seigo> On Tue, 22 May 2001 04:48:38 -0700 (PDT), Seigo> John Baldwin said: John> On 22-May-01 Seigo Tanimura wrote: >>> For now, p_mtx protects p_pgrp in struct proc. This is quite >>> troublesome for the following reason: John> Err, it doesn't really. It's mostly undecided at this point. Also, have you John> looked at the BSD/OS code on builder? They have process groups and sessions John> already locked not using global locks but using per-data structure locks. Seigo> If you do not protect both p_pgrp and p_pglist in struct proc by an Seigo> identical lock, you end up with breaking either setpgid(2) or kill(2) Seigo> for a process group. The following scenario depicts an example of the Seigo> breakage: BSD/OS seems to solve that problem by having p_session in struct proc, and protecting p_pgrp by the mutex of both a process and a session. Then you have to lock a session as well as a process prior to reading p_pgrp, as I locked proctree_lock. I chose proctree_lock because deleting a process group may call funsetown(), which calls free(9). Maybe we can reconsider protecting by a session lock when free(9) becomes not to lock lockmgr. -- Seigo Tanimura To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message