From owner-freebsd-current@FreeBSD.ORG Mon May 5 23:25:23 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C0AA637B401; Mon, 5 May 2003 23:25:23 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id C352A43FBF; Mon, 5 May 2003 23:25:22 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.8/8.12.3) with ESMTP id h466PLA7050165; Tue, 6 May 2003 00:25:21 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 06 May 2003 00:22:52 -0600 (MDT) Message-Id: <20030506.002252.71669019.imp@bsdimp.com> To: jhb@freebsd.org From: "M. Warner Losh" In-Reply-To: References: <02ed01c31347$56f023d0$932a40c1@PHE> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org cc: pete@he.iki.fi Subject: Re: kthread_exit and giant X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2003 06:25:24 -0000 In message: John Baldwin writes: : : On 05-May-2003 Petri Helenius wrote: : >> : >> The kthread is supposed to acquire Giant before calling kthread_exit(). : >> Actually, my guess is that the ar kthread needs to acquire Giant for the : >> lifetime of the thread. I have an untested patch locally: : >> : > I thought the lifetime of the thread is the duration of the rebuild process? Which : > can be minutes to hours. Locking giant for that kind of time does not sound : > right, so locking it just before thread exit sounds like the right thing to do, : > as long as the code othervise keeps critical sections locked. : : Giant is dropped when a thread sleeps. It is designed to protect code : that is not fully locked yet. It is useful to note that it is dropped automatically when you sleep, which is different than all the other mutexes in the system. Those mutexes do not drop when you sleep (unles you drop them with msleep). Warner