Messages in this thread | | | From | David Howells <> | Subject | Re: [PATCH 05/12] x86 rwsem: take advantage of new RWSEM_WAITING_BIAS semantics | Date | Wed, 12 May 2010 13:10:29 +0100 |
| |
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
| |