kthread_exit and giant

John Baldwin jhb at FreeBSD.org
Mon May 5 14:25:04 PDT 2003


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.

-- 

John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


More information about the freebsd-current mailing list