Re: pgsql: Dramatically reduce System V shared memory consumption. - Mailing list pgsql-committers

From Andres Freund
Subject Re: pgsql: Dramatically reduce System V shared memory consumption.
Date
Msg-id 201206291934.05319.andres@2ndquadrant.com
Whole thread Raw
In response to pgsql: Dramatically reduce System V shared memory consumption.  (Robert Haas <rhaas@postgresql.org>)
Responses Re: pgsql: Dramatically reduce System V shared memory consumption.
List 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 by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pgsql: pg_dump: Fix verbosity level in LO progress messages
Next
From: Tom Lane
Date:
Subject: pgsql: Fix confusion between "size" and "AnonymousShmemSize".