From: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
---|---|
To: | Ni Ku <jakkuniku(at)gmail(dot)com> |
Cc: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: Changing shared_buffers without restart |
Date: | 2025-03-21 09:31:04 |
Message-ID: | kgytdkyohq4kw7p2r7vvp64wuaerpb7r65yminhqvffbdyn7eh@67wvb6kbjqwp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Fri, Mar 21, 2025 at 04:48:30PM GMT, Ni Ku wrote:
> Thanks for your insights and confirmation, Dmitry.
> Right, I think the anonymous fd approach would work to keep the memory
> contents intact in between munmap and mmap with the new size, so bufferpool
> expansion would work.
> But it seems shrinking would still be problematic, since that approach
> requires the anonymous fd to remain open (for memory content protection),
> and so munmap would not release the memory back to the OS right away (gets
> released when the fd is closed). From testing this is true for hugepage
> memory at least.
> Is there a way around this? Or maybe I misunderstood what you have in mind
> ;)
The anonymous file will be truncated to it's new shrinked size before
mapping it second time (I think this part is missing in your test
example), to my understanding after a quick look at do_vmi_align_munmap,
this should be enough to make the memory reclaimable.
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Jones | 2025-03-21 09:47:09 | Re: [PATCH] Add CANONICAL option to xmlserialize |
Previous Message | Richard Guo | 2025-03-21 09:14:40 | Reduce "Var IS [NOT] NULL" quals during constant folding |