[RFC] powerpc: optimizing random() and POSIX question
Raphael M Zinsly
rzinsly@linux.ibm.com
Tue Feb 11 14:04:00 GMT 2020
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
More information about the Libc-alpha
mailing list