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: Andi Kleen <andi at firstfloor dot org>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: Rich Felker <dalias at aerifal dot cx>, Andi Kleen <andi at firstfloor dot org>, 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 17:59:19 +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>
On Fri, Jun 21, 2013 at 04:02:46PM +0200, Torvald Riegel wrote:
> On Fri, 2013-06-21 at 12:48 +0200, Torvald Riegel wrote:
> > On Thu, 2013-06-20 at 21:23 -0400, Rich Felker wrote:
> > > On Thu, Jun 20, 2013 at 08:34:31PM +0200, Torvald Riegel wrote:
> > > > Carlos asked me to send a more detailed plan for how we could split up
> > > > Andi's work so that we can commit the parts that we can (hopefully) get
> > > > consensus on before the freeze. This might have some rough edges, but
> > > > should show what I have in mind. Comments?
> > > >
> > > > 1) Give PTHREAD_MUTEX_DEFAULT a new enum value != 0 (and thus not equal
> > > > to PTHREAD_MUTEX_NORMAL's value)
> > >
> > > I agree this would be a better choice than changing the value of
> > > PTHREAD_MUTEX_NORMAL. However, I have one additional idea: what about
> > > swapping the two values when they move from pthread_mutexattr_t to
> > > pthread_mutex_t? That way, existing mutexes initialized by
> > > PTHREAD_MUTEX_INITIALIZER would have default type (and thus could use
> > > elision) rather than having normal type. This is the approach we'll
> > > probably use in musl if we add elision at some point.
> >
> > Right, and that's the direction we discussed in the 2.18 thread just a
> > while before you posted this. Please have a look.
>
> Attached is a start of a patch to clarify what I mean. What is
> obviously missing is handling the new PTHREAD_MUTEX_NORMAL_INT_NP in all
> of the mutex functions, but that should be rather straight-forward, I
> assume.
>
> Comments?
Couldn't it be done much simpler, like hiding it all in settype,
without other changes:
settype:
- old ABI: when 0 is specified set the don't elide bit
- new ABI: when new NORMAL is specified set the don't elide bit,
but change the type to 0
Any holes in this?
-Andi