pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Preallocate some DSM space at startup.
3+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2020-07-31 7be04496a9  Fix compiler warning from Clang.
* pgsql: Preallocate some DSM space at startup.
@ 2020-07-31 05:54 Thomas Munro <tmunro@postgresql.org>
  2020-07-31 06:26 ` Re: pgsql: Preallocate some DSM space at startup. Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 3+ messages in thread

From: Thomas Munro @ 2020-07-31 05:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Preallocate some DSM space at startup.

Create an optional region in the main shared memory segment that can be
used to acquire and release "fast" DSM segments, and can benefit from
huge pages allocated at cluster startup time, if configured.  Fall back
to the existing mechanisms when that space is full.  The size is
controlled by a new GUC min_dynamic_shared_memory, defaulting to 0.

Main region DSM segments initially contain whatever garbage the memory
held last time they were used, rather than zeroes.  That change revealed
that DSA areas failed to initialize themselves correctly in memory that
wasn't zeroed first, so fix that problem.

Discussion: https://postgr.es/m/CA%2BhUKGLAE2QBv-WgGp%2BD9P_J-%3Dyne3zof9nfMaqq1h3EGHFXYQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/84b1c63ad41872792d47e523363fce1f0e230022

Modified Files
--------------
doc/src/sgml/config.sgml                      |  24 ++++
src/backend/storage/ipc/dsm.c                 | 191 +++++++++++++++++++++++---
src/backend/storage/ipc/dsm_impl.c            |   3 +
src/backend/storage/ipc/ipci.c                |   3 +
src/backend/utils/misc/guc.c                  |  11 ++
src/backend/utils/misc/postgresql.conf.sample |   1 +
src/backend/utils/mmgr/dsa.c                  |   5 +-
src/include/storage/dsm.h                     |   3 +
src/include/storage/dsm_impl.h                |   1 +
9 files changed, 216 insertions(+), 26 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Preallocate some DSM space at startup.
  2020-07-31 05:54 pgsql: Preallocate some DSM space at startup. Thomas Munro <tmunro@postgresql.org>
@ 2020-07-31 06:26 ` Michael Paquier <michael@paquier.xyz>
  2020-07-31 07:12   ` Re: pgsql: Preallocate some DSM space at startup. Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Paquier @ 2020-07-31 06:26 UTC (permalink / raw)
  To: Thomas Munro <tmunro@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

Hi Thomas,

On Fri, Jul 31, 2020 at 05:54:45AM +0000, Thomas Munro wrote:
> Preallocate some DSM space at startup.
> 
> Create an optional region in the main shared memory segment that can be
> used to acquire and release "fast" DSM segments, and can benefit from
> huge pages allocated at cluster startup time, if configured.  Fall back
> to the existing mechanisms when that space is full.  The size is
> controlled by a new GUC min_dynamic_shared_memory, defaulting to 0.
> 
> Main region DSM segments initially contain whatever garbage the memory
> held last time they were used, rather than zeroes.  That change revealed
> that DSA areas failed to initialize themselves correctly in memory that
> wasn't zeroed first, so fix that problem.

longfin is complaning on this one:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=longfin&dt=2020-07-31%2005%3A59%3A08
guc.c:2241:38: error: implicit conversion from 'unsigned long' to
'int' changes value from 17592186044415 to -1
[-Werror,-Wconstant-conversion]
                0, 0, Min(INT_MAX, SIZE_MAX / 1024 / 1024),
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../../../../src/include/c.h:927:40: note: expanded from macro 'Min'

#define Min(x, y)    ((x) < (y) ? (x) : (y))
                                         ^
1 error generated.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Preallocate some DSM space at startup.
  2020-07-31 05:54 pgsql: Preallocate some DSM space at startup. Thomas Munro <tmunro@postgresql.org>
  2020-07-31 06:26 ` Re: pgsql: Preallocate some DSM space at startup. Michael Paquier <michael@paquier.xyz>
@ 2020-07-31 07:12   ` Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Munro @ 2020-07-31 07:12 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Thomas Munro <tmunro@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Fri, Jul 31, 2020 at 6:26 PM Michael Paquier <michael@paquier.xyz> wrote:
> longfin is complaning on this one:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=longfin&dt=2020-07-31%2005%3A59%3A08
> guc.c:2241:38: error: implicit conversion from 'unsigned long' to
> 'int' changes value from 17592186044415 to -1
> [-Werror,-Wconstant-conversion]
>                 0, 0, Min(INT_MAX, SIZE_MAX / 1024 / 1024),
>                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

Thanks.  I pushed a fix after checking on Clang 11 and GCC 8 that it's
warning-free and produces the value I want on 32 and 64 bit builds.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-07-31 07:12 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31 05:54 pgsql: Preallocate some DSM space at startup. Thomas Munro <tmunro@postgresql.org>
2020-07-31 06:26 ` Michael Paquier <michael@paquier.xyz>
2020-07-31 07:12   ` Thomas Munro <thomas.munro@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox