Re: Align large shared memory allocations

From: Manfred Spraul <manfred(at)colorfullife(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Align large shared memory allocations
Date: 2003-09-21 10:49:45
Message-ID: 3F6D8249.6070702@colorfullife.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:

>Manfred Spraul <manfred(at)colorfullife(dot)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?
>
>
7.4cvs on a 1.13 GHz Intel Celeron mobile, 384 MB RAM, "Severn" RedHat
Linux 2.4 beta, postmaster -N 30 -B 64, data directory on ramdisk,
pgbench -c 10 -s 11 -t 1000:
Without the patch: 124 tps
with the patch: 130 tps.

I've reduced the buffer setting to 64 because without that, a too large
part of the database was cached by postgres. I expect that with all
Intel Pentium III chips, it will be worth 10-20% less system time. I had
around 30% system time after reducing the number of buffers, thus the
~5% performance improvement.

>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.
>
>
Ok, new patch attached.

--
Manfred

Attachment Content-Type Size
patch-align text/plain 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2003-09-21 11:04:43 Re: pgsql-server/src/backend catalog/index.c comma ...
Previous Message Dave Page 2003-09-21 10:26:58 Re: Killing the backend to cancel a long waiting query

Browse pgsql-patches by date

  From Date Subject
Next Message Hiroshi Inoue 2003-09-21 11:04:43 Re: pgsql-server/src/backend catalog/index.c comma ...
Previous Message Peter Eisentraut 2003-09-21 10:16:32 Re: contrib mode - pgenv