public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alicja Kucharczyk <[email protected]>
To: Laurenz Albe <[email protected]>
Cc: Ron Johnson <[email protected]>
Cc: Pgsql-admin <[email protected]>
Subject: Re: Setting huge_pages=off when HugePages are allocated in Linux?
Date: Thu, 29 Jan 2026 16:09:08 +0100
Message-ID: <CAM=sWa7wFBK26fNFsmNdOgH27TgeYfqk=MmTGHCbyfN0VWzQBQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CANzqJaD0Nj2SvXrGCM-p_TUaeN84TzRteo7jxqSdARaZDiXABA@mail.gmail.com>
	<[email protected]>

śr., 28 sty 2026 o 18:02 Laurenz Albe <[email protected]> napisał(a):

> > In the example in this (quite helpful) Cybertec post, 10475 HugePages
> are allocated.
> > https://www.cybertec-postgresql.com/en/huge-pages-postgresql/
> >
> > If we set "huge_pages = off" within PG and then restart PG, will Linux
> see those 10475 HugePages as off-limits to normal 4KiB allocations?
>
> Yes.  That's why it is a good idea to set "huge_pages = on" if you intend
> to use them with
> PostgreSQL.  Otherwise it may happen that PostgreSQL resorts to allocating
> shared buffers
> using normal memory, and your huge pages just sit around and are wasted.
>
> Yours,
> Laurenz Albe
>

I fully agree with Laurenz.

And it’s basically the same story the other way around: if you set
huge_pages = on but you reserved too many huge pages, the extra ones will
also just sit there unused, i.e. wasted.

What slightly worries me is this line in the docs:
“While we need at least 3170 huge pages in this example, a larger setting
would be appropriate if other programs on the machine also need huge pages.”

I get what it’s trying to say (size for all consumers), but it can read a
bit like “more is fine”. On a dedicated PostgreSQL server, “more” is
usually just wasted memory unless you actually have another hugepage user.

It might be worth adding a short note that unused huge pages don’t get used
for regular memory allocations, so it’s best to size them as close to what
you need as possible (especially on dedicated servers).

regards,
A.Kucharczyk


reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Setting huge_pages=off when HugePages are allocated in Linux?
  In-Reply-To: <CAM=sWa7wFBK26fNFsmNdOgH27TgeYfqk=MmTGHCbyfN0VWzQBQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox