On Wed, Sep 6, 2017 at 9:42 AM, Sokolov Yura <funny.fal...@postgrespro.ru> wrote: > Yes, you're right. > > But I think, generic version still should be "fixed". > If generic version is not reached on any platform, then why it is kept? > If it is reached somewhere, then it should be improved.
This seems like a pretty sound argument to me. I think Tom's probably right that the changes in generic-gcc.h are the important ones, but I'm not sure that's an argument against patching generics.h. Given that pg_atomic_compare_exchange_u32_impl is defined to update *old there seems to be no reason to call pg_atomic_read_u32_impl every time through the loop. Whether doing so hurts performance in practice is likely to depend on a bunch of stuff, but we don't normally refuse to remove unnecessary code on the grounds that it will rarely be reached. Given that CPUs are weird, it's possible that there is some system where throwing an extra read of a value we already have into the loop works out to a win, but in the absence of evidence I'm reluctant to presume it. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers