[HACKERS] ShmemAlloc() alignment patch

2006-07-14 Thread Qingqing Zhou
In ShmemAlloc() we have: newStart = BUFFERALIGN(newStart); newSpace = (void *) (ShmemBase + newStart); return newSpace; Notice that though newStart is ALIGNOF_BUFFER, ShmemBase is not. Thus the newSpace is not aligned as we disired. Attached please find the patch. Regards, Qingqing

Re: [HACKERS] ShmemAlloc() alignment patch

2006-07-14 Thread Martijn van Oosterhout
On Fri, Jul 14, 2006 at 02:50:31PM +0800, Qingqing Zhou wrote: In ShmemAlloc() we have: newStart = BUFFERALIGN(newStart); newSpace = (void *) (ShmemBase + newStart); return newSpace; Notice that though newStart is ALIGNOF_BUFFER, ShmemBase is not. Thus the newSpace is not aligned

Re: [HACKERS] ShmemAlloc() alignment patch

2006-07-14 Thread Tom Lane
Martijn van Oosterhout kleptog@svana.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

Re: [HACKERS] ShmemAlloc() alignment patch

2006-07-14 Thread Bruce Momjian
Tom Lane wrote: Martijn van Oosterhout kleptog@svana.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

Re: [HACKERS] ShmemAlloc() alignment patch

2006-07-14 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: How can ShmemBase not be aligned? Surely it's page-aligned? Should we add an assert? No, because even if it's not page-aligned, there's no correctness issue here. (Besides, how would you know what the page size is on any given platform?)