This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix elision in nested trylock.
- From: Andi Kleen <andi at firstfloor dot org>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: Andi Kleen <andi at firstfloor dot org>, GLIBC Devel <libc-alpha at sourceware dot org>, Carlos O'Donell <carlos at redhat dot com>
- Date: Mon, 1 Jul 2013 21:39:46 +0200
- Subject: Re: [PATCH] Fix elision in nested trylock.
- References: <1372288203 dot 22198 dot 1113 dot camel at triegel dot csb> <20130627004146 dot GK6123 at two dot firstfloor dot org> <1372323284 dot 22198 dot 2309 dot camel at triegel dot csb> <20130627191642 dot GP6123 at two dot firstfloor dot org> <1372706690 dot 22198 dot 3982 dot camel at triegel dot csb>
> 1) An xabort outside of a transaction must be fast. If it's slow for
> some reason, this would slow down locks for which we could but don't use
> elision.
An abort that is not aborting is fairly fast (a few cycles)
> What was wrong
> with "if (*try_lock > 0) _xabort(_ABORT_LOCK_BUSY);" (except perhaps a
> missing builtin_expect)?
The check adds unnecessary overhead.
> Finally, this only works for HTMs for which
> xabort outside a transaction is a no-op.
The code is TSX specific and TSX defines xabort to a no-op outside
transactions.
I believe it's also fairly clear to anyone familiar with the TSX
specification, and if they are not they should not touch this code.
-Andi