From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Abhijit Menon-Sen <ams@2ndquadrant.com>
Subject: Re: munmap() failure due to sloppy handling of hugepage size
Date: Wed, 12 Oct 2016 19:04:32 -0300
Message-ID: <20161012220432.GA943701@alvherre.pgsql> (raw)
In-Reply-To: <31426.1476304418@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On October 12, 2016 1:25:54 PM PDT, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> A little bit of research suggests that on Linux the thing to do would
> >> be to get the actual default hugepage size by reading /proc/meminfo and
> >> looking for a line like "Hugepagesize: 2048 kB".
>
> > We had that, but Heikki ripped it out when merging... I think you're supposed to use /sys to get the available size.
>
> According to
> https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt
> looking into /proc/meminfo is the longer-standing API and thus is
> likely to work on more kernel versions. Also, if you look into
> /sys then you are going to see multiple possible values and it's
> not clear how to choose the right one.
I'm not sure that this is the best rationale. In my system there are
2MB and 1GB huge page sizes; in systems with lots of memory (let's say 8
GB of shared memory is requested) it seems a clear winner to allocate 8
1GB hugepages than 4096 2MB hugepages because the page table is so much
smaller. The /proc interface only shows the 2MB page size, so if we go
that route we'd not be getting the full benefit of the feature.
We could just fall back to reading /proc if we cannot find the /sys
stuff; that makes it continue to work on older kernels.
Regarding choosing one among several size choices, I'd think the larger
huge page size is always better if the request size is at least that
large, otherwise fall back to the next smaller one. (This could stand
some actual research).
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us, andres@anarazel.de, hlinnaka@iki.fi, ams@2ndquadrant.com
Subject: Re: munmap() failure due to sloppy handling of hugepage size
In-Reply-To: <20161012220432.GA943701@alvherre.pgsql>
References: <31426.1476304418@sss.pgh.pa.us> <20161012220432.GA943701@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox