Re: pgsql: Dramatically reduce System V shared memory consumption.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pgsql: Dramatically reduce System V shared memory consumption.
Дата
Msg-id 201206291934.05319.andres@2ndquadrant.com
обсуждение исходный текст
Ответ на pgsql: Dramatically reduce System V shared memory consumption.  (Robert Haas <rhaas@postgresql.org>)
Ответы Re: pgsql: Dramatically reduce System V shared memory consumption.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers
Hi Robert,

You have a small typo in the patch:


+       /*
+        * pagesize will, for practical purposes, always be a power of two.
+        * But just in case it isn't, we do it this way instead of using
+        * TYPEALIGN().
+        */
+       AnonymousShmemSize = size;
+       if (size % pagesize != 0)
+           AnonymousShmemSize += pagesize - (size % pagesize);
+
+       /*
+        * We assume that no one will attempt to run PostgreSQL 9.3 or later
+        * on systems that are ancient enough that anonymous shared memory is
+        * not supported, such as pre-2.4 versions of Linux.  If that turns
out
+        * to be false, we might need to add a run-time test here and do this
+        * only if the running kernel supports it.
+        */
+       AnonymousShmem = mmap(NULL, size, PROT_READ|PROT_WRITE, PG_MMAP_FLAGS,
+                             -1, 0);

Note that you use size in the mmap...

Andres
--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

В списке pgsql-committers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: pgsql: pg_dump: Fix verbosity level in LO progress messages
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix confusion between "size" and "AnonymousShmemSize".