Re: brlock_is_locked()?

From: Jens Axboe (axboe@suse.de)
Date: Fri Aug 24 2001 - 01:49:31 EST


On Wed, Aug 22 2001, Brad Chapman wrote:
> > (I checked the brlock code and didn't find any schedule()s; there's
> > probably a reason for that).
> >
> > Ummm, this is SMP 101, you can't sleep with a lock held.
> > The global kernel lock is special in this regard, but all
> > other SMP locking primitives may not sleep.
>
> Grrr....I read Rusty's Unreliable Guide to Kernel Locking (twice) and
> still didn't remember that. Guess you have to schedule() yourself.

Errr, like Dave said, _you cannot sleep while holding a lock_. It's not
just that the locking primitives themselves don't sleep, you must not
call schedule() (or any other function that may block/sleep) while
holding a lock. _That's_ SMP 101 :-)

-- 
Jens Axboe

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Aug 31 2001 - 21:00:07 EST