From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
'GNU C Library' <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Use C11 atomics instead atomic_decrement_and_test
Date: Fri, 23 Sep 2022 10:28:17 -0300 [thread overview]
Message-ID: <7ee6df40-c391-8d75-040f-dcf57b7c3609@linaro.org> (raw)
In-Reply-To: <AS4PR08MB79015CBB8BD278558EE4C5C2834E9@AS4PR08MB7901.eurprd08.prod.outlook.com>
On 22/09/22 10:55, Wilco Dijkstra wrote:
> 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?
The htl is used the pthread implementation on Hurd. I am not sure if this support
multiprocessor environments, so I will let Hurd developers figure out if they need
to fix it.
>
>> 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.
Ack.
>
>> 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.
Ok.
>
> Cheers,
> Wilco
Patch looks good me then.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
prev parent reply other threads:[~2022-09-23 13:28 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
2022-09-23 13:28 ` Adhemerval Zanella Netto [this message]
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=7ee6df40-c391-8d75-040f-dcf57b7c3609@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=Wilco.Dijkstra@arm.com \
--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).