Re: Shared memory size computation oversight?

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: robertmhaas(at)gmail(dot)com
Subject: Re: Shared memory size computation oversight?
Date: 2021-08-12 13:34:27
Message-ID: da2a9fd1-b135-5dc4-ff5d-3e3447a6b3c9@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2021-08-12 14:01:14 Re: call popcount32/64 directly on non-x86 platforms
Previous Message David Rowley 2021-08-12 13:33:06 Re: call popcount32/64 directly on non-x86 platforms