Re: pgsql: Improve 64bit atomics support.

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Improve 64bit atomics support.
Date: 2017-04-07 23:16:34
Message-ID: CAPpHfdt6U7n7aM8MdNQNPF_oC28T3C4WUkFyY2GAycVmUiWp+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Sat, Apr 8, 2017 at 12:50 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:

> Additionally optimize reads/writes to 64bit on a number of platforms
> where aligned writes of that size are atomic. This can now be tested
> with PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY.
>

BTW, PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY is never used.

It's likely you meant something like this.

diff --git a/src/include/port/atomics/generic.h
b/src/include/port/atomics/generic.h
new file mode 100644
index c094248..c430bf5
*** a/src/include/port/atomics/generic.h
--- b/src/include/port/atomics/generic.h
*************** pg_atomic_exchange_u64_impl(volatile pg_
*** 271,277 ****
}
#endif

! #ifndef PG_HAVE_ATOMIC_READ_U64
#define PG_HAVE_ATOMIC_READ_U64
static inline uint64
pg_atomic_read_u64_impl(volatile pg_atomic_uint64 *ptr)
--- 271,277 ----
}
#endif

! #if !defined(PG_HAVE_ATOMIC_READ_U64) &&
defined(PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY)
#define PG_HAVE_ATOMIC_READ_U64
static inline uint64
pg_atomic_read_u64_impl(volatile pg_atomic_uint64 *ptr)
*************** pg_atomic_read_u64_impl(volatile pg_atom
*** 280,286 ****
}
#endif

! #ifndef PG_HAVE_ATOMIC_WRITE_U64
#define PG_HAVE_ATOMIC_WRITE_U64
static inline void
pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val)
--- 280,286 ----
}
#endif

! #if !defined(PG_HAVE_ATOMIC_WRITE_U64) &&
defined(PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY)
#define PG_HAVE_ATOMIC_WRITE_U64
static inline void
pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val)

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2017-04-07 23:36:09 Re: [COMMITTERS] pgsql: Improve 64bit atomics support.
Previous Message Alvaro Herrera 2017-04-07 22:55:21 Re: [COMMITTERS] pgsql: Improve 64bit atomics support.

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-04-07 23:33:21 Re: WAL logging problem in 9.4.3?
Previous Message Peter Eisentraut 2017-04-07 23:13:20 Re: Interval for launching the table sync worker