Re: [PATCH] lockref: remove cpu_relax() again

From: Linus Torvalds
Date: Thu Sep 05 2013 - 13:53:14 EST


On Thu, Sep 5, 2013 at 10:35 AM, Luck, Tony <tony.luck@xxxxxxxxx> wrote:
>
> So Linus is right that the cpu_relax() makes things less fair ... but without it performance sucks so
> much that I don't want to use the clever cmpxchg at all - I'm much better off without it!

Hmm. Is this single-socket? The thing really only is supposed to help
if there's tons of contention.

Also, it strikes me that ia64 has tons of different versions of
cmpxchg, and the one you use by default is the one with "acquire"
semantics. That may well be the right thing to do, but I have this
possibly unfounded gut feeling that you might want to try using a
relaxed cmpxchg and then perhaps have a memory barrier *after* it has
successfully executed.

I'll have to think a bit more about what the exact memory ordering
requirements for lockref's are, but my gut feel is that just for
incrementing the reference count you don't actually have any real
memory ordering requirements.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/