Re: [Linux-ia64] reader-writer livelock problem

From: Linus Torvalds (torvalds@transmeta.com)
Date: Fri Nov 08 2002 - 12:57:13 EST


In article <1036777105.13021.13.camel@ixodes.goop.org>,
Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
>Even without interrupts that would be a bug. It isn't ever safe to
>attempt to retake a read lock if you already hold it, because you may
>deadlock with a pending writer. Fair multi-reader locks aren't
>recursive locks.

.. but I don't think we have any real users who use them for recursion,
so the only "recursion" right now is through interrupts that use this
feature.

(At least that was true a long time time ago, maybe we've added truly
recursive users since)

>> Actually, giving this som emore thought, I really suspect that the
>> simplest solution is to alloc a separate "fair_read_lock()", and paths
>> that need to care about fairness (and know they don't have the irq
>> issue)
>> can use that, slowly porting users over one by one...
>
>Do you mean have a separate lock type, or have two different read_lock
>operations on the current type?

That depends on whether it is even sanely implementable to share the
same lock. It may not be.

>From a migration standpoint it would be easiest (by far) to be able to
share the lock type and to mix operations (ie an interrupt - or
recursive user - could just use the non-fair version, while others could
use the fair version on the same lock). However, I have this nagging
suspicion that it might be a total nightmare to implement efficiently in
practice.

I've not looked at it. Any ideas?

                Linus
-
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 Nov 15 2002 - 22:00:16 EST