Re: Changing shared_buffers without restart - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Changing shared_buffers without restart
Date
Msg-id 397218.1732844567@sss.pgh.pa.us
Whole thread Raw
In response to Re: Changing shared_buffers without restart  (Matthias van de Meent <boekewurm+postgres@gmail.com>)
List pgsql-hackers
Matthias van de Meent <boekewurm+postgres@gmail.com> writes:
> I mean, we can do the following to get a nice contiguous empty address
> space no other mmap(NULL)s will get put into:

>     /* reserve size bytes of memory */
>     base = mmap(NULL, size, PROT_NONE, ...flags, ...);
>     /* use the first small_size bytes of that reservation */
>     allocated_in_reserved = mmap(base, small_size, PROT_READ |
> PROT_WRITE, MAP_FIXED, ...);

> With the PROT_NONE protection option the OS doesn't actually allocate
> any backing memory, but guarantees no other mmap(NULL, ...) will get
> placed in that area such that it overlaps with that allocation until
> the area is munmap-ed, thus allowing us to reserve a chunk of address
> space without actually using (much) memory.

Well, that's all great if it works portably.  But I don't see one word
in either POSIX or the Linux mmap(2) man page that promises those
semantics for PROT_NONE.  I also wonder how well a giant chunk of
"unbacked" address space will interoperate with the OOM killer,
top(1)'s display of used memory, and other things that have caused us
headaches with large shared-memory arenas.

Maybe those issues are all in the past and this'll work great.
I'm not holding my breath though.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tender Wang
Date:
Subject: Re: Remove an unnecessary check on semijoin_target_ok() on postgres_fdw.c
Next
From: Junwang Zhao
Date:
Subject: Re: Make COPY format extendable: Extract COPY TO format implementations