mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jens Gustedt <jens.gustedt@inria.fr>
To: musl@lists.openwall.com
Subject: Re: In-progress stuff, week of Sept 1
Date: Fri, 05 Sep 2014 09:41:42 +0200	[thread overview]
Message-ID: <1409902902.4856.32.camel@eris.loria.fr> (raw)
In-Reply-To: <20140905011442.GA26136@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 4212 bytes --]

Hello,

Am Donnerstag, den 04.09.2014, 21:14 -0400 schrieb Rich Felker:
> First, things that definitely are going in this release cycle:
> 
> - Jens Gustedt's C11 threads: From discussion it's ready, but the last
>   iteration of the patches added more gratuitous changes at the same
>   time it removed others. Jens is going to be less available for a
>   while, so I'm going to finish getting the patches ready to commit,
>   but it's going to take a little work going back and reviewing the
>   email threads to determine what was the outcome of discussion versus
>   what's new, and among what's new, whether it's essential or side
>   changes orthogonal to adding C11 threads.

Sorry if that left that impression to you. There is only one thing I
remember, that is not really sorted out in the last patch series I
sent, the timespec_get things. The other patches should be relatively
clean, no? In particular, the higher numbered patches (I think it was
8 and 9) can just be omitted, if you don't like them.

In any case, just send me requests for diff's or entire files in that
or that version, my git history contains them all.

> Finally, here are the non-trivial open items that probably won't make
> it into this release:
> 
> Jens Gustedt's work on cond var improvements:
> 
> Based on our previous discussions, I think the proposed changes are
> valid, but I also think they make the code mildly more complex. So
> they're probably justified only if we can measure a performance
> improvement under at least some usage cases. The ideal way I'd like to
> move forward with these is with some tests that could measure the lock
> contention from the race between signaling and early waiter exit
> (timeout or cancellation).

I have other points that I delayed for later. Off my head:

 - review atomics

   * This starts by adding some "i" constraints to the assembler. Gcc is
   perfectly capable to optimize static inlined asm that has "ir"
   constraints. In the code a lot of these are used with constants 0
   or 1, this would shave of the use of a register at all these
   points.

   * Review the necessity of having all of these with "memory". As long
   as the pointer argument is constrained with "m" and not "p", this
   should suffice to encode the data dependency. The only thing that
   we'd have to be careful with is reordering, but I think this could
   be achieved by using `volatile`, instead.

   * Move to gcc's __sync and __atomic builtins. The first are available
   since always, and both are easily testable with macros. In case of
   __atomic this would make it possible to move the atomics used in
   musl to acquire-release semantics, which may pay for some archs, in
   particular arm, I think.

   This also should make it easier to port to new architectures in the
   future, as soon as there is a working gcc for it.

 - implement a simple lock feature based on futex that encodes the
   wait counter inside the `int`.

   After the discussion with Rich some weeks ago I gave it a thought,
   and I think this can be simply done by using the parity bit for the
   lock and the other bits for the waiters count. On i386 the parity
   bit (as any other bit) can effectively accessed atomically with
   "lock ; btsl ".

   IIRC, having such a simple lock would also help as a third step of
   the changes to cv that I proposed and that you mention above.

 - __timedwait translates absolute time to relative time, by taking
   the current time with clock_gettime. This could be avoided for
   CLOCK_REALTIME and CLOCK_MONOTONIC when using FUTEX_WAIT_BITSET
   instead of FUTEX_WAIT. That one uses absolute time from the
   start. Since C threads don't leave a chose for the clock they are
   using this would avoid using this code path completely and shave of
   one system call.

Jens

-- 
:: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  parent reply	other threads:[~2014-09-05  7:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05  1:14 Rich Felker
2014-09-05  1:57 ` Szabolcs Nagy
2014-09-05  8:47   ` Rich Felker
2014-09-05  9:07     ` Alexander Monakov
2014-09-05 16:02       ` Rich Felker
2014-09-05 17:40         ` Alexander Monakov
2014-09-05 18:06           ` Rich Felker
2014-09-05  7:41 ` Jens Gustedt [this message]
2014-09-05  8:32   ` Rich Felker
2014-09-05  9:27     ` Jens Gustedt
2014-09-05 16:45       ` Rich Felker
2014-09-05 17:09         ` Alexander Monakov
2014-09-06  7:04         ` Jens Gustedt
2014-09-05  8:49 ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409902902.4856.32.camel@eris.loria.fr \
    --to=jens.gustedt@inria.fr \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).