lkml.org 
[lkml]   [2010]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 05/12] x86 rwsem: take advantage of new RWSEM_WAITING_BIAS semantics
Date
Michel Lespinasse <walken@google.com> wrote:

> static inline void __up_write(struct rw_semaphore *sem)
> {
> ...
> LOCK_PREFIX " xadd %1,(%2)\n\t"
> - /* tries to transition
> - 0xffff0001 -> 0x00000000 */
> - " jz 1f\n"
> + /* substracts 0xffff0001, returns the old value */
> + " cmp %4,%1\n\t"
> + /* are there waiting threads and no active threads ? */
> + " jne 1f\n"
> " call call_rwsem_wake\n"

It looks like you're betting on there being fast-path contention. If the
common case is no fast-path contention, then you'd be better off putting the
comparison out of line in the medium-path and retaining the JZ instruction.

The same goes for __up_read(): you could retain the JNS there and put the
comparison out of line into the medium-path.

Doing this also saves you some code space.

David


\
 
 \ /
  Last update: 2010-05-12 14:13    [W:1.361 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site