From: Andres Freund <andres@anarazel.de>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: [COMMITTERS] pgsql: Move each SLRU's lwlocks to a separate tranche.
Date: Mon, 11 Apr 2016 04:31:38 -0700
Message-ID: <20160411113138.amwskmlzi4wwhy2f@alap3.anarazel.de> (raw)
In-Reply-To: <CA+TgmoZxpmV6LapSSpGLd5ftQ6KAsyqPfxEi_i6jE=OSPfy1Zw@mail.gmail.com>
References: <E1Zwy2E-0003Rt-1O@gemulon.postgresql.org>
<20160325070506.56i5p7jzxwqfljm6@alap3.anarazel.de>
<CA+TgmoZ4PsKukByQbpADpshmhWY99C-fM_Pk5RE2_ahXTn8BNA@mail.gmail.com>
<31588.1458913723@sss.pgh.pa.us>
<CA+TgmoZyRUV=SFEppyDiDNApEH_p=5C8_GSnochQRQksVSpAAQ@mail.gmail.com>
<14166.1458924422@sss.pgh.pa.us>
<CA+TgmobOqZt1FG2YpmvpUoOBRPHL5vjnHy8cay6fs_h1pM-hLw@mail.gmail.com>
<20160410230856.xont3ukgmsnpygrf@alap3.anarazel.de>
<20160411040101.ll2ouzvjy7xawzfo@alap3.anarazel.de>
<CA+TgmoZxpmV6LapSSpGLd5ftQ6KAsyqPfxEi_i6jE=OSPfy1Zw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Hi,
On 2016-04-11 07:09:18 -0400, Robert Haas wrote:
> Attached patch does that.
Thanks.
> > Additionally, doesn't this obsolete
> >
> > /*
> > * Preferred alignment for disk I/O buffers. On some CPUs, copies between
> > * user space and kernel space are significantly faster if the user buffer
> > * is aligned on a larger-than-MAXALIGN boundary. Ideally this should be
> > * a platform-dependent value, but for now we just hard-wire it.
> > */
> > #define ALIGNOF_BUFFER 32
>
> I didn't go as far as trying to remove this; a few other random things
> are using it.
All of the places using it look like they actually rather should use
CACHELINEALIGN...
> diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
> index 1ad68cd..8e6cbdb 100644
> --- a/src/backend/storage/ipc/shmem.c
> +++ b/src/backend/storage/ipc/shmem.c
> @@ -112,6 +112,7 @@ void
> InitShmemAllocation(void)
> {
> PGShmemHeader *shmhdr = ShmemSegHdr;
> + char *aligned;
>
> Assert(shmhdr != NULL);
>
> @@ -139,6 +140,11 @@ InitShmemAllocation(void)
> shmhdr->freeoffset += MAXALIGN(sizeof(slock_t));
> Assert(shmhdr->freeoffset <= shmhdr->totalsize);
>
> + /* Make sure the first allocation begins on a cache line boundary. */
> + aligned = (char *)
> + (CACHELINEALIGN((((char *) shmhdr) + shmhdr->freeoffset)));
> + shmhdr->freeoffset = aligned - (char *) shmhdr;
> +
> SpinLockInit(ShmemLock);
In the patch attached to http://www.postgresql.org/message-id/20160411051004.yvniqb2pkc7re5k7@alap3.anarazel.de
I did this instead by fixing up the actual shared memory allocation,
which seems a tiny bit cleaner. But the asserts added there seem like a
worthwhile addition to me.
Greetings,
Andres Freund
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Move each SLRU's lwlocks to a separate tranche.
In-Reply-To: <20160411113138.amwskmlzi4wwhy2f@alap3.anarazel.de>
References: <E1Zwy2E-0003Rt-1O@gemulon.postgresql.org> <20160325070506.56i5p7jzxwqfljm6@alap3.anarazel.de> <CA+TgmoZ4PsKukByQbpADpshmhWY99C-fM_Pk5RE2_ahXTn8BNA@mail.gmail.com> <31588.1458913723@sss.pgh.pa.us> <CA+TgmoZyRUV=SFEppyDiDNApEH_p=5C8_GSnochQRQksVSpAAQ@mail.gmail.com> <14166.1458924422@sss.pgh.pa.us> <CA+TgmobOqZt1FG2YpmvpUoOBRPHL5vjnHy8cay6fs_h1pM-hLw@mail.gmail.com> <20160410230856.xont3ukgmsnpygrf@alap3.anarazel.de> <20160411040101.ll2ouzvjy7xawzfo@alap3.anarazel.de> <CA+TgmoZxpmV6LapSSpGLd5ftQ6KAsyqPfxEi_i6jE=OSPfy1Zw@mail.gmail.com> <20160411113138.amwskmlzi4wwhy2f@alap3.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox