[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 05 May 2010 12:09:59 +0100
From: David Howells <dhowells@...hat.com>
To: Michel Lespinasse <walken@...gle.com>
Cc: dhowells@...hat.com, Andrew Morton <akpm@...ux-foundation.org>,
Linux-MM <linux-mm@...ck.org>, Ying Han <yinghan@...gle.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: rwsem: down_read_unfair() proposal
Michel Lespinasse <walken@...gle.com> wrote:
> I only said it was doable :) Not done with the implementation yet, but I can
> describe the general idea if that helps. The high part of the rwsem is
> decremented by two for each thread holding or trying to acquire a write
> lock;
That would mean you're reducing the capacity of the upper counter by one since
the high part must remain negative if we're to be able to check it for
non-zeroness by checking the sign flag. That means a maximum of 2^14-1 writers
queued on a 32-bit box (16384), but we can have more threads than that (up to
~32767).
Currently, we can have a maximum of 32767 writers+readers queued as we only
decrement the upper counter by 1 each time.
On a 64-bit box, the limitations go away for all practical purposes.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists