From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
'GNU C Library' <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Use C11 atomics instead atomic_decrement_and_test
Date: Thu, 22 Sep 2022 13:55:28 +0000 [thread overview]
Message-ID: <AS4PR08MB79015CBB8BD278558EE4C5C2834E9@AS4PR08MB7901.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <e9d8e688-3368-a517-6334-7f4a4bab7521@linaro.org>
Hi Adhemerval,
> + if (atomic_fetch_add_relaxed (&pthread->nr_refs, -1) != 1)
> return;
>
> /* Withdraw this thread from the thread ID lookup table. */
> Ok (and I am not sure why __pthread_create_internal usage does not use atomic at all).
Yes the non-atomic increment is a bug, an in/decrement could be lost if there is
a data race. Is it still used or could we default to nptl and remove the htl stuff?
> I am not sure if MO is suffice here, shouldn't it synchronize with the update
> from __pthread_create_internal?
As discussed in my previous mail, __pthread_total and __nptl_nthreads are simple
counters that decide when to call exit for the last thread.
> Ok, although this code is not used anywhere (neither for testing). Maybe it would be better
> to just remove it.
Yes, it looks like it was added 20 years ago as some kind of internal benchmark - I'll remove it
in the commit.
Cheers,
Wilco
next prev parent reply other threads:[~2022-09-22 13:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 14:06 Wilco Dijkstra
2022-09-21 17:27 ` Adhemerval Zanella Netto
2022-09-22 13:55 ` Wilco Dijkstra [this message]
2022-09-23 13:28 ` Adhemerval Zanella Netto
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=AS4PR08MB79015CBB8BD278558EE4C5C2834E9@AS4PR08MB7901.eurprd08.prod.outlook.com \
--to=wilco.dijkstra@arm.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).