mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH 2/2] avoid taking _c_lock if we know it isn't necessary
Date: Wed, 27 Aug 2014 16:07:56 -0400	[thread overview]
Message-ID: <20140827200756.GS12888@brightrain.aerifal.cx> (raw)
In-Reply-To: <1409133335.4476.30.camel@eris.loria.fr>

On Wed, Aug 27, 2014 at 11:57:47AM +0200, Jens Gustedt wrote:
> +		/* Since this leaving waiter might not have held the _c_lock, the following       */
> +		/* __wake might be issued when the signaler is still inside its CS.               */
> +		/* But if so, this avoids a __wait of the signaler, which more important.         */
> +		/* This should not target any spurious wake up in any other thread:               */
> +		/* ref is on the stack of the signaler, and that signaler is still alive.         */
>  		if (ref) {
>  			if (a_fetch_add(ref, -1)==1)
>  				__wake(ref, 1, 1);

Can't you avoid that with the design I suggested, having the signaler
use an extra ref count on itself, which it decrements right before
waiting?

Aside from that, based on my reading so far, these patches look like
they should work correctly. But since we both want to get C11 threads
done, let's put them aside for now (pending some testing for
measurable benefits). I also have some other potential changes to this
code based on my latest comments to:

http://austingroupbugs.net/view.php?id=609

regarding things they seem to deem as requirements, and which musl
does not satisfy, that are specified in non-normative text. So there's
likely to be more cond var work to do before the release still...

Rich


  reply	other threads:[~2014-08-27 20:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27  9:57 Jens Gustedt
2014-08-27 20:07 ` Rich Felker [this message]
2014-08-27 21:30   ` Jens Gustedt
2014-08-27 21:48     ` 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=20140827200756.GS12888@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --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).