Re: Align large shared memory allocations - Mailing list pgsql-patches

From Tom Lane
Subject Re: Align large shared memory allocations
Date
Msg-id 29494.1064094926@sss.pgh.pa.us
Whole thread Raw
In response to Align large shared memory allocations  (Manfred Spraul <manfred@colorfullife.com>)
Responses Re: Align large shared memory allocations  (Manfred Spraul <manfred@colorfullife.com>)
List pgsql-patches
Manfred Spraul <manfred@colorfullife.com> writes:
> Attached is a patch that aligns large shared memory allocations beyond
> MAXIMUM_ALIGNOF. The reason for this is that Intel's cpus have a fast
> path for bulk memory copies that only works with aligned addresses.

This patch is missing a demonstration that it's actually worth anything.
What kind of performance gain do you get?

> One problem is the "32" - it's arbitrary, it probably belongs into an
> arch dependant header file. But where?

We don't really have arch-dependent header files.  What I'd be inclined
to do is "#define ALIGNOF_BUFFER 32" in pg_config_manual.h, then
#define BUFFERALIGN(LEN) to parallel the other TYPEALIGN macros in c.h,
and finally use that in the ShmemAlloc code.

            regards, tom lane

pgsql-patches by date:

Previous
From: Manfred Spraul
Date:
Subject: Align large shared memory allocations
Next
From: Mike Mascari
Date:
Subject: contrib mode - pgenv