[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <y2p8d20b11a1005041538zc2daea6cg2580e8cc14ccf8ed@mail.gmail.com>
Date: Tue, 4 May 2010 15:38:56 -0700
From: Michel Lespinasse <walken@...gle.com>
To: David Howells <dhowells@...hat.com>
Cc: Andrew Morton <akpm@...gle.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: x86 rwsem: up_read() does not check active count in fast path
On Tue, May 4, 2010 at 5:41 AM, David Howells <dhowells@...hat.com> wrote:
> Michel Lespinasse <walken@...gle.com> wrote:
>
>> Looking at the x86 rwsem code, I have been wondering about the up_read()
>> path. __rwsem_do_wake() comment mentions that one should check the active
>> count on the way there; however I could not find that check when coming from
>> up_read().
>
> Look in call_rwsem_wake(), which is implemented in assembly in two places in
> the x86 arch:
>
> arch/x86/lib/rwsem_64.S
> arch/x86/lib/semaphore_32.S
Gah thanks, I had totally missed that part (I knew about these files
but I had taken these as pure ABI wrappers; I did not notice the one
nugget of interesting logic hiding in there).
BTW, what's the reason for doing this check in call_rwsem_wake ? The
check is entirely redundant in the __up_write() case; and in
__up_read() things might be less confusing if edx was used locally
rather than in a separate function.
--
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
--
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