Re: Changing shared_buffers without restart
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>,
Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org, Robert Haas <robertmhaas@gmail.com>
Date: 2025-01-13T08:11:06Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Remove PG_MMAP_FLAGS from mem.h
- c100340729b6 19 (unreleased) landed
-
Improve runtime and output of tests for replication slots checkpointing.
- 4464fddf7b50 18.0 cited
-
Revert support for improved tracking of nested queries
- f85f6ab051b7 18.0 cited
-
Use exported symbols list on macOS for loadable modules as well
- 3feff3916ee1 18.0 cited
-
Add support for basic NUMA awareness
- 65c298f61fc7 18.0 cited
-
Avoid unnecessary copying of a string in pg_restore.c
- 5e1915439085 18.0 cited
-
aio: Infrastructure for io_method=worker
- 55b454d0e140 18.0 cited
-
Improve InitShmemAccess() prototype
- 2a7b2d97171d 18.0 landed
Attachments
- 0002-Allow-placing-shared-memory-mapping-with-an-20250113.patch (text/x-patch) patch 0002
- 0005-Use-anonymous-files-to-back-shared-memory-s-20250113.patch (text/x-patch) patch 0005
- 0001-Allow-to-use-multiple-shared-memory-mapping-20250113.patch (text/x-patch) patch 0001
- 0004-Allow-to-resize-shared-memory-without-resta-20250113.patch (text/x-patch) patch 0004
- 0003-Introduce-multiple-shmem-slots-for-shared-b-20250113.patch (text/x-patch) patch 0003
- 0006-Add-TODOs-and-questions-about-previous-comm-20250113.patch (text/x-patch) patch 0006
Hi Dmitry, On Tue, Dec 17, 2024 at 7:40 PM Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> wrote: > > I could verify the memory mappings, their sizes etc. by looking at > /proc/PID/maps and /proc/PID/status but I did not find a way to verify > the amount of memory actually allocated and verify that it's actually > shrinking and expanding. Please let me know how to verify that. As somewhere mentioned upthread, the mmap or mremap by themselves do not allocate any memory. Writing to the mapped region causes memory to be allocated and shows up in VmRSS and RssShmem. But it does get resized if mremap() shrinks the mapped region. Attached are patches rebased on top of commit 2a7b2d97171dd39dca7cefb91008a3c84ec003ba. I have also fixed compilation errors. Otherwise I haven't changed anything in the patches. The last patches adds some TODOs and questions, which I think we need to address while completing this work, just add for as a reminder later. The TODO in postgres.c is related to your observation > Another rough edge is that a > backend, executing pg_reload_conf interactively, will not resize > mappings immediately, for some reason it will require another command. I don't have a solution right now, but at least the comment documents the reason and points to its origin. I am next looking at the problem of synchronizing the change across the backends. -- Best Wishes, Ashutosh Bapat