lkml.org 
[lkml]   [2010]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: x86 rwsem: up_read() does not check active count in fast path
From
On Tue, May 4, 2010 at 5:41 AM, David Howells <dhowells@redhat.com> wrote:
> Michel Lespinasse <walken@google.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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-05-05 00:41    [W:0.045 / U:4.312 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site