From: Raphael M Zinsly <rzinsly@linux.ibm.com>
To: libc-alpha@sourceware.org
Cc: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>,
Paul Clarke <pc@us.ibm.com>
Subject: [RFC] powerpc: optimizing random() and POSIX question
Date: Tue, 11 Feb 2020 14:04:00 -0000 [thread overview]
Message-ID: <2b9bee0c-ffa0-f7cd-4333-0ef28971b955@linux.ibm.com> (raw)
Hi,
Iâm investigating ways to optimize random() for powerpc and got some
questions regarding POSIX.
The current code on stdlib/random.c does:
long int
__random (void)
{
int32_t retval;
__libc_lock_lock (lock);
(void) __random_r (&unsafe_state, &retval);
__libc_lock_unlock (lock);
return retval;
}
If I remove the lock in order to use lqarx/stqcx to access fptr and rptr
(that are adjacents), then compute the result as is done in random_r,
will this still be compliant with POSIX?
As the data is accessed atomically, only one thread access the critical
section at a time. Am I missing something?
Thanks,
--
Raphael Moreira Zinsly
IBM
Linux on Power Toolchain
next reply other threads:[~2020-02-11 14:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-11 14:04 Raphael M Zinsly [this message]
2020-02-11 14:43 ` Florian Weimer
2020-02-12 13:22 ` Raphael M Zinsly
2020-02-12 13:23 ` Florian Weimer
2020-02-12 14:20 ` Adhemerval Zanella
2020-02-12 15:05 Wilco Dijkstra
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=2b9bee0c-ffa0-f7cd-4333-0ef28971b955@linux.ibm.com \
--to=rzinsly@linux.ibm.com \
--cc=libc-alpha@sourceware.org \
--cc=pc@us.ibm.com \
--cc=tuliom@linux.ibm.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.
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).