Re: Memory buffer alignment - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Memory buffer alignment
Date
Msg-id 200309272108.h8RL8co10477@candle.pha.pa.us
Whole thread Raw
In response to Re: Memory buffer alignment  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Memory buffer alignment  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I found this very interested, and realize we have shared buffers aligned
at 8-bytes in CVS.

However, I know if I allocate an 8k block, it will usually be aligned on
an 8k boundary, right?  I know the i386 uses 4k memory pages, and it
certainly seems like it would be a good idea to have the 8k buffers
aligned on 4k offsets.

Can someone run some tests to find out if there is any value to doing 4k
offsets for shared buffer pages?  I am also interested to see if any
speed improvement can be seen with a MAXIMUM_ALIGNOF to 8.

---------------------------------------------------------------------------

Tom Lane wrote:
> Manfred Spraul <manfred@colorfullife.com> writes:
> > Unfortunately it's the slower one: Intel cpus have a microcode fastpath 
> > for memcopies that are 8-byte aligned. This fastpath is around 50% 
> > faster than the manual copy that is used for "misaligned" (i.e. only 
> > 4-byte aligned) pointers.
> 
> Maybe it'd be worth setting MAXIMUM_ALIGNOF to 8 on such CPUs?  Or at
> least hacking ShmemAlloc and friends to use 8-byte alignment.  I assume
> the major issue here is that the shared buffers don't get 8-byte-aligned
> within the shared memory segment.
> 
> Are there any machines where it'd be worth forcing an even larger
> alignment for the buffers?
> 
>             regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PostgreSQL 7.4beta3 does not compile on AIX 5 ...
Next
From: Tom Lane
Date:
Subject: Re: Memory buffer alignment