diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-01-29 13:44:45 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-01-29 14:08:30 +0200 |
commit | 1a3458b6d8d202715a83c88474a1b63726d0929e (patch) | |
tree | ea1f7c5a36cefc7b5b5dee50ac1b99fe082ed9c9 /doc/src | |
parent | b7643b19f0fdbfb1636db52e39db4be6f0174ce0 (diff) | |
download | postgresql-1a3458b6d8d202715a83c88474a1b63726d0929e.tar.gz postgresql-1a3458b6d8d202715a83c88474a1b63726d0929e.zip |
Allow using huge TLB pages on Linux (MAP_HUGETLB)
This patch adds an option, huge_tlb_pages, which allows requesting the
shared memory segment to be allocated using huge pages, by using the
MAP_HUGETLB flag in mmap(). This can improve performance.
The default is 'try', which means that we will attempt using huge pages,
and fall back to non-huge pages if it doesn't work. Currently, only Linux
has MAP_HUGETLB. On other platforms, the default 'try' behaves the same as
'off'.
In the passing, don't try to round the mmap() size to a multiple of
pagesize. mmap() doesn't require that, and there's no particular reason for
PostgreSQL to do that either. When using MAP_HUGETLB, however, round the
request size up to nearest 2MB boundary. This is to work around a bug in
some Linux kernel versions, but also to avoid wasting memory, because the
kernel will round the size up anyway.
Many people were involved in writing this patch, including Christian Kruse,
Richard Poole, Abhijit Menon-Sen, reviewed by Peter Geoghegan, Andres Freund
and me.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/config.sgml | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 14ed6c7a53b..e7c255987da 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1107,6 +1107,43 @@ include 'filename' </listitem> </varlistentry> + <varlistentry id="guc-huge-tlb-pages" xreflabel="huge_tlb_pages"> + <term><varname>huge_tlb_pages</varname> (<type>enum</type>)</term> + <indexterm> + <primary><varname>huge_tlb_pages</> configuration parameter</primary> + </indexterm> + <listitem> + <para> + Enables/disables the use of huge TLB pages. Valid values are + <literal>try</literal> (the default), <literal>on</literal>, + and <literal>off</literal>. + </para> + + <para> + At present, this feature is supported only on Linux. The setting + is ignored on other systems. + </para> + + <para> + The use of huge TLB pages results in smaller page tables and + less CPU time spent on memory management, increasing performance. For + more details, see + <ulink url="https://wiki.debian.org/Hugepages">the Debian wiki</ulink>. + Remember that you will need at least shared_buffers / huge page size + + 1 huge TLB pages. So for example for a system with 6GB shared buffers + and a hugepage size of 2kb of you will need at least 3156 huge pages. + </para> + + <para> + With <varname>huge_tlb_pages</varname> set to <literal>try</literal>, + the server will try to use huge pages, but fall back to using + normal allocation if that fails. With <literal>on</literal, failure + to use huge pages will prevent the server from starting up. With + <literal>off</literal>, huge pages will not be used. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-temp-buffers" xreflabel="temp_buffers"> <term><varname>temp_buffers</varname> (<type>integer</type>)</term> <indexterm> |