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

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-committers(at)postgresql(dot)org
Cc: Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: pgsql: Dramatically reduce System V shared memory consumption.
Date: 2012-06-29 17:34:05
Message-ID: 201206291934.05319.andres@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2012-06-29 19:12:21 pgsql: Fix confusion between "size" and "AnonymousShmemSize".
Previous Message Alvaro Herrera 2012-06-29 16:59:29 Re: pgsql: pg_dump: Fix verbosity level in LO progress messages