Re: [PATCH] Add support for choosing huge page size

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Odin Ugedal <odin(at)ugedal(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add support for choosing huge page size
Date: 2020-06-08 22:26:26
Message-ID: CA+hUKGKRaM9jZk9OmeXVf52u4HM1Ks=Q9w0wTB+MpHMd5t-NAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 9, 2020 at 4:13 AM Odin Ugedal <odin(at)ugedal(dot)com> wrote:
> This adds support for using non-default huge page sizes for shared
> memory. This is achived via the new "huge_page_size" config entry.
> The config value defaults to 0, meaning it will use the system default.
> ---
>
> This would be very helpful when running in kubernetes since nodes may
> support multiple huge page sizes, and have pre-allocated huge page meory
> for each size. This lets the user select huge page size without having
> to change the default huge page size on the node. This will also be
> useful when doing benchmarking with different huge page sizes, since it
> wouldn't require a full system reboot.

+1

> Since the default value of the new config is 0 (resulting in using the
> default huge page size) this should be backwards compatible with old
> configs.

+1

> Feel free to comment on the phrasing (both in docs and code) and on the
> overall change.

This change seems good to me, because it will make testing easier and
certain mixed page size configurations possible. I haven't tried your
patch yet; I'll take it for a spin when I'm benchmarking some other
relevant stuff soon.

Minor comments on wording:

> + <para>
> + Most modern linux systems support <literal>2MB</literal> and <literal>1GB</literal>
> + huge pages, and some architectures supports other sizes as well. For more information
> + on how to check for support and usage, see <xref linkend="linux-huge-pages"/>.

Linux with a capital L. Hmm, I don't especially like saying "Most
modern Linux systems" as code for Intel. I wonder if we should
instead say something like: "Some commonly available page sizes on
modern 64 bit server architectures include: <literal>2MB<literal> and
<literal>1GB</literal> (Intel and AMD), <literal>16MB</literal> and
<literal>16GB</literal> (IBM POWER), and ... (ARM)."

> + </para>
> + <para>
> + Controling huge page size is not supported on Windows.

Controlling

Just by the way, some googling is telling me that very recent versions
of Windows *could* support this (search keywords:
"NtAllocateVirtualMemoryEx 1GB"), so that could be a project for
someone who understands Windows to look into later.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-06-08 22:53:38 Remove SpinLockFree() / S_LOCK_FREE()?
Previous Message Tom Lane 2020-06-08 22:21:06 Re: valgrind versus pg_atomic_init()