This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: TSX lock elision for glibc v12
- From: Torvald Riegel <triegel at redhat dot com>
- To: Andi Kleen <andi at firstfloor dot org>
- Cc: Rich Felker <dalias at aerifal dot cx>, libc-alpha at sourceware dot org, "Carlos O'Donell" <carlos at redhat dot com>, Roland McGrath <roland at hack dot frob dot com>
- Date: Fri, 21 Jun 2013 21:32:22 +0200
- Subject: Re: TSX lock elision for glibc v12
- References: <1371592286-22073-1-git-send-email-andi at firstfloor dot org> <1371753271 dot 964 dot 2220 dot camel at triegel dot csb> <20130621012328 dot GA29800 at brightrain dot aerifal dot cx> <1371811686 dot 964 dot 4100 dot camel at triegel dot csb> <1371823366 dot 964 dot 4706 dot camel at triegel dot csb> <1371824261 dot 964 dot 4757 dot camel at triegel dot csb> <1371826829 dot 964 dot 4905 dot camel at triegel dot csb> <20130621160924 dot GN6123 at two dot firstfloor dot org> <1371833629 dot 964 dot 5253 dot camel at triegel dot csb> <20130621172701 dot GO6123 at two dot firstfloor dot org>
On Fri, 2013-06-21 at 19:27 +0200, Andi Kleen wrote:
> > I don't want to change or expose anything externally if I don't have to.
> > This will make it easier for us to just enable elision without risking
> > to have to maintain other interfaces, break ABIs, etc.
>
> I don't see the point of checking a new number on all the fast paths
> when it doesn't do anything different.
It adds a distinction that we have to adhere to whenever we want to do
elision. When you represent it with flags you make the same
distinction. But a single new type is better. The one
PTHREAD_MUTEX_DEFAULT_INT_NP alias is just to make it clear that this is
not a TIMED_NP mutex or such, but has DEFAULT semantics.
The flags can be combined with other things in your patch set. That's
more different states, actually.
Finally, we don't do anything with it yet because it's *obviously* a
distinction added for elision. Once you use elision, you will treat
PTHREAD_MUTEX_DEFAULT_INT_NP and PTHREAD_MUTEX_NORMAL_INT_NP
differently.
> With elision it's just the same as TIMED_NP | NO_ELISION
>
> So why not use that internally?
First of all, there's no consensus to expose any of the elision flags
externally. So they would have to be internal flags. And if users
can't set them, it's *much* cleaner to just make the single distinction
that we didn't do (split out PTHREAD_MUTEX_NORMAL_INT_NP) and which
prevents us to use elision widely.
Second, this is not necessarily useful for just elision. Also see
Roland's comments about that.