Re: ShmemAlloc() alignment patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ShmemAlloc() alignment patch
Date: 2006-07-14 14:54:48
Message-ID: 19660.1152888888@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> On Fri, Jul 14, 2006 at 02:50:31PM +0800, Qingqing Zhou wrote:
>> Notice that though newStart is ALIGNOF_BUFFER, ShmemBase is not. Thus the
>> newSpace is not aligned as we disired.

> How can ShmemBase not be aligned? Surely it's page-aligned?

That's certainly what the code expects. I'm disinclined to apply this
patch unless you can identify a real system where ShmemBase might not
point to a page boundary.

(Note: in a standalone backend, the "shared memory segment" is just a
huge malloc chunk, and so depending on your platform it might not be
page-aligned. I don't feel a need to add cycles to ShmemAlloc to
optimize this case, though. We only care about performance in the
normal shared-memory case.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-07-14 14:56:48 Re: ShmemAlloc() alignment patch
Previous Message Tom Lane 2006-07-14 14:50:31 Re: putting CHECK_FOR_INTERRUPTS in qsort_comparetup()