Re: Shared memory size computation oversight? - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Shared memory size computation oversight?
Date
Msg-id da2a9fd1-b135-5dc4-ff5d-3e3447a6b3c9@enterprisedb.com
Whole thread Raw
Responses Re: Shared memory size computation oversight?  (Julien Rouhaud <rjuju123@gmail.com>)
List pgsql-hackers
On 27.02.21 09:08, Julien Rouhaud wrote:
> PFA a patch that fixes pg_prewarm and pg_stat_statements explicit alignment to
> CACHELINEALIGN, and also update the alignment in hash_estimate_size() to what I
> think ShmemInitHash will actually consume.

For extensions, wouldn't it make things better if 
RequestAddinShmemSpace() applied CACHELINEALIGN() to its argument?

If you consider the typical sequence of RequestAddinShmemSpace(mysize()) 
and later ShmemInitStruct(..., mysize(), ...), then the size gets 
rounded up to cache-line size in the second case and not the first.  The 
premise in your patch is that the extension should figure that out 
before calling RequestAddinShmemSpace(), but that seems wrong.

Btw., I think your patch was wrong to apply CACHELINEALIGN() to 
intermediate results rather than at the end.



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: call popcount32/64 directly on non-x86 platforms
Next
From: John Naylor
Date:
Subject: Re: call popcount32/64 directly on non-x86 platforms