Re: R/W semaphore changes

From: Arjan van de Ven
Date: Tue Jul 04 2006 - 09:15:54 EST


On Tue, 2006-07-04 at 14:05 +0100, David Howells wrote:
> Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
>
> > > Please, please, please don't. R/W semaphores are _not_ permitted to nest.
> >
> > yet they do in places, there where there is a natural hierarchy..
>
> Where? I believe the mm used to but no longer does.
>
> They still aren't allowed to. Consider:
>
> CPU 1 CPU 2
> ======================= =======================
> -->down_read(&A);
> <--down_read(&A);
> -->down_write(&A);
> --- SLEEPING ---
> -->down_read(&A);
> --- DEADLOCKED ---

you mean recursion, while nesting != recursion!
(for examples of nesting see the general lockdep documentation)
With nesting we mean

down_read(&A);
down_read(&B);

where A and B are a similar lock but not the same exact instance (for
example two inode locks of different inodes)


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