Re: kthread_exit and giant

From: M. Warner Losh <imp_at_bsdimp.com>
Date: Tue, 06 May 2003 00:22:52 -0600 (MDT)
In message: <XFMail.20030505172507.jhb_at_FreeBSD.org>
            John Baldwin <jhb_at_freebsd.org> 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
Received on Mon May 05 2003 - 21:25:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:06 UTC