From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) |
Cc: | hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] mmap and MAP_ANON |
Date: | 1998-05-13 18:02:18 |
Message-ID: | 199805131802.OAA23134@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>
> "Gran Thyni" <goran(at)bildbasen(dot)se> writes:
> > Linux can only MAP_SHARED if the file is a *real* file,
> > devices or trick like MAP_ANON does only work with MAP_PRIVATE.
>
> Well, this makes some sense: MAP_SHARED implies that the shared memory
> will also be accessible to independently started processes, and
> to do that you have to have an openable filename to refer to the
> data segment by.
>
> MAP_PRIVATE will *not* work for our purposes: according to my copy
> of mmap(2):
Right.
> so privately mapped segments are useless for interprocess communication,
> even after we get rid of exec().
Yep.
>
> mmaping /dev/zero, as has been suggested earlier in this thread,
> seems like a really bad idea to me. Would that not imply that
> any process anywhere in the system that also decides to mmap /dev/zero
> would get its hands on the Postgres shared memory segment? You
> can't restrict permissions on /dev/zero to prevent it.
Good point.
>
> Am I right in thinking that the contents of the shared memory segment
> do not need to outlive a particular postmaster run? (If they do, then
> we have to mmap a real file anyway.) If so, then MAP_ANON(YMOUS) is
> a reasonable solution on systems that support it. On those that
> don't support it, we will have to mmap a real file owned by (and only
> readable/writable by) the postgres user. Time for another configure
> test.
MAP_ANON is the best, because it can be restricted to only postmaster
children.
The problem with using a real file is that the filesystem is going to be
flushing those dirty pages to disk, and that could really hurt
performance.
Actually, when I install Informix, I always have to modify the kernel to
allow a larger amount of SYSV shared memory. Maybe we just need to give
people per-OS instructions on how to do that. Under BSD/OS, I now have
32MB of shared memory, or 3900 8k shared buffers.
--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1998-05-13 18:06:04 | Re: [HACKERS] Re: [QUESTIONS] money or dollar type |
Previous Message | Tom Lane | 1998-05-13 17:36:15 | Re: [HACKERS] Re: [QUESTIONS] money or dollar type |