From: Carlos O'Donell <carlos@redhat.com>
To: Florian Weimer <fweimer@redhat.com>,
Arjun Shankar <arjun.is@lostca.se>,
libc-alpha@sourceware.org
Subject: Re: [PATCH v2] Fix double-checked locking in __gconv_get_path and __gconv_read_conf [BZ #22062]
Date: Thu, 05 Oct 2017 23:05:00 -0000 [thread overview]
Message-ID: <08eed690-d5eb-ce13-0c61-15a93e4bc8a7@redhat.com> (raw)
In-Reply-To: <bb082ab0-d1db-c0a9-afda-e489b5d3ee6d@redhat.com>
On 10/05/2017 03:20 PM, Florian Weimer wrote:
> On 10/05/2017 10:22 PM, Carlos O'Donell wrote:
>> Is there any reason we need this atomic load?
>
> Based on the context, it's not clear to which load you are referring.
>
> Florian
My apologies, clipped, to show context:
> + if (gconv_path_elem_local == NULL)
> + {
> + __gconv_get_path ();
Multiple reads by threads are safe. In this case we can have multiple threads
here, but all writes to __gconv_path_elem are complete. All we are doing is
having multiple readers, which is not a data race.
Is there any reason we need this atomic load?
> + gconv_path_elem_local = atomic_load_relaxed (&__gconv_path_elem);
^^^^^^^^^^^^^^^^^^^
In the exiting free_mem case I can see the argument for a detached thread
doing the initialization while free_mem is called, and it should be thread
safe to call exit and these functions, avoiding the data race, but perhaps
still crashing for other reasons. We are being consistent in our use of
atomic accesses to provide data race freedom.
But in this case there is no race. Is it just belt-and-suspenders? If so,
we should comment on that.
--
Cheers,
Carlos.
next prev parent reply other threads:[~2017-10-05 23:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-02 14:31 Arjun Shankar
2017-10-05 15:18 ` Florian Weimer
2017-10-05 20:23 ` Carlos O'Donell
2017-10-05 22:20 ` Florian Weimer
2017-10-05 23:05 ` Carlos O'Donell [this message]
2017-10-06 6:38 ` Florian Weimer
2017-10-10 19:08 ` Carlos O'Donell
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=08eed690-d5eb-ce13-0c61-15a93e4bc8a7@redhat.com \
--to=carlos@redhat.com \
--cc=arjun.is@lostca.se \
--cc=fweimer@redhat.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).