Date: Fri, 05 Sep 2014 09:41:42 +0200 From: Jens Gustedt <jens.gustedt@...ia.fr> To: musl@...ts.openwall.com Subject: Re: In-progress stuff, week of Sept 1 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 :: Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.