From: DJ Delorie <dj@redhat.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Use C11 atomics instead atomic_add(_zero)
Date: Thu, 08 Sep 2022 15:49:46 -0400 [thread overview]
Message-ID: <xnillx3aud.fsf@greed.delorie.com> (raw)
In-Reply-To: <AS4PR08MB7901184AE0FAD0D7E9ABBBE783409@AS4PR08MB7901.eurprd08.prod.outlook.com>
Wilco Dijkstra via Libc-alpha <libc-alpha@sourceware.org> writes:
> - atomic_add (&mp_.mmapped_mem, -total_size);
> + atomic_fetch_add_relaxed (&mp_.mmapped_mem, -total_size);
Ok.
> - atomic_add (&noai6ai_cached.usecnt, 2);
> + atomic_fetch_add_relaxed (&noai6ai_cached.usecnt, 2);
Ok.
> - && atomic_add_zero (&olddata->usecnt, -1))
> + && atomic_fetch_add_relaxed (&olddata->usecnt, -1) == 1)
atomic_add_zero includes the comparison, so Ok.
> - if (atomic_add_zero (&data->usecnt, -1))
> + if (atomic_fetch_add_relaxed (&data->usecnt, -1) == 1)
Ok.
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
prev parent reply other threads:[~2022-09-08 19:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 14:04 Wilco Dijkstra
2022-09-08 19:49 ` DJ Delorie [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=xnillx3aud.fsf@greed.delorie.com \
--to=dj@redhat.com \
--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).