Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcfbd8a7

Browse files
committed
Add mmap info. Seems mmap may not be a good idea.
1 parent698a0b8 commitcfbd8a7

File tree

1 file changed

+242
-0
lines changed

1 file changed

+242
-0
lines changed

‎doc/TODO.detail/mmap

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
From pgsql-hackers-owner+M5149@postgresql.org Mon Feb 26 03:32:49 2001
2+
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
3+
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id DAA04497
4+
for <pgman@candle.pha.pa.us>; Mon, 26 Feb 2001 03:32:48 -0500 (EST)
5+
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
6+
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f1Q8TSx48319;
7+
Mon, 26 Feb 2001 03:29:28 -0500 (EST)
8+
(envelope-from pgsql-hackers-owner+M5149@postgresql.org)
9+
Received: from store.d.zembu.com (nat.zembu.com [209.128.96.253])
10+
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1Q8LPx47243
11+
for <pgsql-hackers@postgreSQL.org>; Mon, 26 Feb 2001 03:21:25 -0500 (EST)
12+
(envelope-from ncm@zembu.com)
13+
Received: by store.d.zembu.com (Postfix, from userid 509)
14+
id 58E39A782; Mon, 26 Feb 2001 00:21:25 -0800 (PST)
15+
Date: Mon, 26 Feb 2001 00:21:25 -0800
16+
To: pgsql-hackers@postgresql.org
17+
Subject: Re: [HACKERS] Re: [PATCHES] A patch for xlog.c
18+
Message-ID: <20010226002125.A2430@store.zembu.com>
19+
Reply-To: pgsql-hackers@postgresql.org
20+
References: <200102260200.VAA17397@candle.pha.pa.us> <22318.983161726@sss.pgh.pa.us>
21+
Mime-Version: 1.0
22+
Content-Type: text/plain; charset=us-ascii
23+
Content-Disposition: inline
24+
User-Agent: Mutt/1.2.5i
25+
In-Reply-To: <22318.983161726@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Sun, Feb 25, 2001 at 11:28:46PM -0500
26+
From: ncm@zembu.com (Nathan Myers)
27+
Precedence: bulk
28+
Sender: pgsql-hackers-owner@postgresql.org
29+
Status: ORr
30+
31+
On Sun, Feb 25, 2001 at 11:28:46PM -0500, Tom Lane wrote:
32+
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
33+
> > It allows no backing store on disk.
34+
35+
I.e. it allows you to map memory without an associated inode; the memory
36+
may still be swapped. Of course, there is no problem with mapping an
37+
inode too, so that unrelated processes can join in. Solarix has a flag
38+
to pin the shared pages in RAM so they can't be swapped out.
39+
40+
> > It is the BSD solution to SysV
41+
> > share memory. Here are all the BSDi flags:
42+
>
43+
> > MAP_ANON Map anonymous memory not associated with any specific
44+
> > file. The file descriptor used for creating MAP_ANON
45+
> > must be -1. The offset parameter is ignored.
46+
>
47+
> Hmm. Now that I read down to the "nonstandard extensions" part of the
48+
> HPUX man page for mmap(), I find
49+
>
50+
> If MAP_ANONYMOUS is set in flags:
51+
>
52+
> o A new memory region is created and initialized to all zeros.
53+
> This memory region can be shared only with descendants of
54+
> the current process.
55+
56+
This is supported on Linux and BSD, but not on Solarix 7. It's not
57+
necessary; you can just map /dev/zero on SysV systems that don't
58+
have MAP_ANON.
59+
60+
> While I've said before that I don't think it's really necessary for
61+
> processes that aren't children of the postmaster to access the shared
62+
> memory, I'm not sure that I want to go over to a mechanism that makes it
63+
> *impossible* for that to be done. Especially not if the only motivation
64+
> is to avoid having to configure the kernel's shared memory settings.
65+
66+
There are enormous advantages to avoiding the need to configure kernel
67+
settings. It makes PG a better citizen. PG is much easier to drop in
68+
and use if you don't need attention from the IT department.
69+
70+
But I don't know of any reason to avoid mapping an actual inode,
71+
so using mmap doesn't necessarily mean giving up sharing among
72+
unrelated processes.
73+
74+
> Besides, what makes you think there's not a limit on the size of shmem
75+
> allocatable via mmap()?
76+
77+
I've never seen any mmap limit documented. Since mmap() is how
78+
everybody implements shared libraries, such a limit would be equivalent
79+
to a limit on how much/many shared libraries are used. mmap() with
80+
MAP_ANONYMOUS (or its SysV /dev/zero equivalent) is a common, modern
81+
way to get raw storage for malloc(), so such a limit would be a limit
82+
on malloc() too.
83+
84+
The mmap architecture comes to us from the Mach microkernel memory
85+
manager, backported into BSD and then copied widely. Since it was
86+
the fundamental mechanism for all memory operations in Mach, arbitrary
87+
limits would make no sense. That it worked so well is the reason it
88+
was copied everywhere else, so adding arbitrary limits while copying
89+
it would be silly. I don't think we'll see any systems like that.
90+
91+
Nathan Myers
92+
ncm@zembu.com
93+
94+
From pgsql-hackers-owner+M6138@postgresql.org Mon Mar 19 07:57:59 2001
95+
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
96+
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id HAA26926
97+
for <pgman@candle.pha.pa.us>; Mon, 19 Mar 2001 07:57:59 -0500 (EST)
98+
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
99+
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2JCug641835;
100+
Mon, 19 Mar 2001 07:56:42 -0500 (EST)
101+
(envelope-from pgsql-hackers-owner+M6138@postgresql.org)
102+
Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20])
103+
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2JCt7641684
104+
for <pgsql-hackers@postgresql.org>; Mon, 19 Mar 2001 07:55:07 -0500 (EST)
105+
(envelope-from bright@fw.wintelcom.net)
106+
Received: (from bright@localhost)
107+
by fw.wintelcom.net (8.10.0/8.10.0) id f2JCt2325289;
108+
Mon, 19 Mar 2001 04:55:02 -0800 (PST)
109+
Date: Mon, 19 Mar 2001 04:55:01 -0800
110+
From: Alfred Perlstein <bright@wintelcom.net>
111+
To: Rod Taylor <rod.taylor@inquent.com>
112+
Cc: Hackers List <pgsql-hackers@postgresql.org>
113+
Subject: Re: [HACKERS] Fw: [vorbis-dev] ogg123: shared memory by mmap()
114+
Message-ID: <20010319045500.T29888@fw.wintelcom.net>
115+
References: <018301c0b070$16049a40$2205010a@jester>
116+
Mime-Version: 1.0
117+
Content-Type: text/plain; charset=us-ascii
118+
Content-Disposition: inline
119+
User-Agent: Mutt/1.2.5i
120+
In-Reply-To: <018301c0b070$16049a40$2205010a@jester>; from rod.taylor@inquent.com on Mon, Mar 19, 2001 at 07:28:21AM -0500
121+
X-all-your-base: are belong to us.
122+
Precedence: bulk
123+
Sender: pgsql-hackers-owner@postgresql.org
124+
Status: ORr
125+
126+
WOOT WOOT! DANGER WILL ROBINSON!
127+
128+
> ----- Original Message -----
129+
> From: "Christian Weisgerber" <naddy@mips.inka.de>
130+
> Newsgroups: list.vorbis.dev
131+
> To: <vorbis-dev@xiph.org>
132+
> Sent: Saturday, March 17, 2001 12:01 PM
133+
> Subject: [vorbis-dev] ogg123: shared memory by mmap()
134+
>
135+
>
136+
> > The patch below adds:
137+
> >
138+
> > - acinclude.m4: A new macro A_FUNC_SMMAP to check that sharing
139+
> pages
140+
> > through mmap() works. This is taken from Joerg Schilling's star.
141+
> > - configure.in: A_FUNC_SMMAP
142+
> > - ogg123/buffer.c: If we have a working mmap(), use it to create
143+
> > a region of shared memory instead of using System V IPC.
144+
> >
145+
> > Works on BSD. Should also work on SVR4 and offspring (Solaris),
146+
> > and Linux.
147+
148+
This is a really bad idea performance wise. Solaris has a special
149+
code path for SYSV shared memory that doesn't require tons of swap
150+
tracking structures per-page/per-process. FreeBSD also has this
151+
optimization (it's off by default, but should work since FreeBSD
152+
4.2 via the sysctl kern.ipc.shm_use_phys=1)
153+
154+
Both OS's use a trick of making the pages non-pageable, this allows
155+
signifigant savings in kernel space required for each attached
156+
process, as well as the use of large pages which reduce the amount
157+
of TLB faults your processes will incurr.
158+
159+
Anyhow, if you could make this a runtime option it wouldn't be so
160+
evil, but as a compile time option, it's a really bad idea for
161+
Solaris and FreeBSD.
162+
163+
--
164+
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
165+
166+
---------------------------(end of broadcast)---------------------------
167+
TIP 2: you can get off all lists at once with the unregister command
168+
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
169+
170+
From pgsql-hackers-owner+M6255@postgresql.org Tue Mar 20 18:46:33 2001
171+
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
172+
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id SAA02887
173+
for <pgman@candle.pha.pa.us>; Tue, 20 Mar 2001 18:46:33 -0500 (EST)
174+
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
175+
by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2KNjtH22390;
176+
Tue, 20 Mar 2001 18:45:55 -0500 (EST)
177+
(envelope-from pgsql-hackers-owner+M6255@postgresql.org)
178+
Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20])
179+
by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KNiFH22033
180+
for <pgsql-hackers@postgresql.org>; Tue, 20 Mar 2001 18:44:15 -0500 (EST)
181+
(envelope-from bright@fw.wintelcom.net)
182+
Received: (from bright@localhost)
183+
by fw.wintelcom.net (8.10.0/8.10.0) id f2KNiAW02417;
184+
Tue, 20 Mar 2001 15:44:10 -0800 (PST)
185+
Date: Tue, 20 Mar 2001 15:44:10 -0800
186+
From: Alfred Perlstein <bright@wintelcom.net>
187+
To: Bruce Momjian <pgman@candle.pha.pa.us>
188+
Cc: Rod Taylor <rod.taylor@inquent.com>,
189+
Hackers List <pgsql-hackers@postgresql.org>
190+
Subject: Re: [HACKERS] Fw: [vorbis-dev] ogg123: shared memory by mmap()
191+
Message-ID: <20010320154410.H29888@fw.wintelcom.net>
192+
References: <20010319045500.T29888@fw.wintelcom.net> <200103202210.RAA23981@candle.pha.pa.us>
193+
Mime-Version: 1.0
194+
Content-Type: text/plain; charset=us-ascii
195+
Content-Disposition: inline
196+
User-Agent: Mutt/1.2.5i
197+
In-Reply-To: <200103202210.RAA23981@candle.pha.pa.us>; from pgman@candle.pha.pa.us on Tue, Mar 20, 2001 at 05:10:33PM -0500
198+
X-all-your-base: are belong to us.
199+
Precedence: bulk
200+
Sender: pgsql-hackers-owner@postgresql.org
201+
Status: OR
202+
203+
* Bruce Momjian <pgman@candle.pha.pa.us> [010320 14:10] wrote:
204+
> > > > The patch below adds:
205+
> > > >
206+
> > > > - acinclude.m4: A new macro A_FUNC_SMMAP to check that sharing
207+
> > > pages
208+
> > > > through mmap() works. This is taken from Joerg Schilling's star.
209+
> > > > - configure.in: A_FUNC_SMMAP
210+
> > > > - ogg123/buffer.c: If we have a working mmap(), use it to create
211+
> > > > a region of shared memory instead of using System V IPC.
212+
> > > >
213+
> > > > Works on BSD. Should also work on SVR4 and offspring (Solaris),
214+
> > > > and Linux.
215+
> >
216+
> > This is a really bad idea performance wise. Solaris has a special
217+
> > code path for SYSV shared memory that doesn't require tons of swap
218+
> > tracking structures per-page/per-process. FreeBSD also has this
219+
> > optimization (it's off by default, but should work since FreeBSD
220+
> > 4.2 via the sysctl kern.ipc.shm_use_phys=1)
221+
>
222+
> >
223+
> > Both OS's use a trick of making the pages non-pageable, this allows
224+
> > signifigant savings in kernel space required for each attached
225+
> > process, as well as the use of large pages which reduce the amount
226+
> > of TLB faults your processes will incurr.
227+
>
228+
> That is interesting. BSDi has SysV shared memory as non-pagable, and I
229+
> always thought of that as a bug. Seems you are saying that having it
230+
> pagable has a significant performance penalty. Interesting.
231+
232+
Yes, having it pageable is actually sort of bad.
233+
234+
It doesn't allow you to do several important optimizations.
235+
236+
--
237+
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
238+
239+
240+
---------------------------(end of broadcast)---------------------------
241+
TIP 4: Don't 'kill -9' the postmaster
242+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp