Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlTe9-00Cn5C-3D for pgsql-admin@arkaria.postgresql.org; Thu, 29 Jan 2026 15:09:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlTe8-009qXa-2M for pgsql-admin@arkaria.postgresql.org; Thu, 29 Jan 2026 15:09:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlTe8-009qXR-12 for pgsql-admin@lists.postgresql.org; Thu, 29 Jan 2026 15:09:24 +0000 Received: from mail-yx1-xb12d.google.com ([2607:f8b0:4864:20::b12d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vlTe6-000000001Fz-00CO for pgsql-admin@lists.postgresql.org; Thu, 29 Jan 2026 15:09:24 +0000 Received: by mail-yx1-xb12d.google.com with SMTP id 956f58d0204a3-649605d3664so1181134d50.3 for ; Thu, 29 Jan 2026 07:09:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769699361; cv=none; d=google.com; s=arc-20240605; b=UKnY4u3JuwFqdqOfcPPpvBo+cVY/XYQT7o18vh/K10vtDUCG9w0znmzaCG/BH72Jvj 6Vhqsbz4RZ8QvHJpYgqkguavuqZIxkppCs45O+RUK2+Q2u4jniRvRIaPCBXony2hEZny ZclLxiwL3VtRoU8A5ggn3JVDY2QcF5zDH3xb/CH78PDGTEavrHTzQPPHhbnem5MWxWo0 bsZbHsPMKVcJ9bR70S5u01Kely3lRhZCK3fNAuBNQXcXfihIM5UpuztFdlQG2tFFZFEd 9Pd4tnJj2eFcaAdTB9CPdqXzDLLZGek8l4A2STBISrJSrBYvI54Jmd22HkFW2BhNrN0+ 6N0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=Wguw1Z3AM60JgnSGjoz0QuEW8gHEozBcW1RQJVnraA0=; fh=dr93MyQcFLXn3YR8YwEA//n1tikCg6rW+xfiPQPRDeU=; b=ZaMpqOOl8431uTAQcnrOvIUWT2h+ZkrmiJDoSuIpu9Da1ZGf0GA0jHFgGR7v2E6QIN RaNEq5KR8VQxTKj9MfoFGKXe6kXWy5tFA4twnbhVe6eR3cWzKT3ljJA5DWHwfXGxVn9y r6J4LCg7HQvR9W7RC0aSWOyetuL8cfwCx9dukv2wvKBndsq9iIyVKSIImXGkopwyKWfg 28IQs5tZA7wuFJSUyGTy7II+Wup7Ar7Q+fGJKNipLm05ZlrhvX8VOFL4cpp4B68rIyk+ JBGQ6GpwqQvgRvP7sXhyWsfhdbrpsGnZ4y+Ma9t+KctvXxiQM3DGYO0G2eGyQEIKa9Hm BDAw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769699361; x=1770304161; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Wguw1Z3AM60JgnSGjoz0QuEW8gHEozBcW1RQJVnraA0=; b=fHW6YJjX8n7mt2gXrlIXPenxb8xBWHLjYWN0i7jSmhCwo02D7rixaMWAF4O1Q4DKjh mHQMZzdMDcftYscLIKcu9F3qqglDrFF4JtG/wnKN2GUaOneBWL6l3BFuFfgEkhgBfm1z 7slWAM2Eapi/f1mm9Ex9Rf5R2YeMNSvNa1p37ug4d96+gdtaJi62jbZ7m1JyPntTXf/m UDfZ8KIdJPWBmIpx3mZD3zNf5WKI6ShNYGLiS7CC0u/82XUhVKFSTKJeUoylgiLRvCk0 ANw1Umzxp4dCAWiy4iQqOJ5tlDBea8LMif+BBlbGn9BXV0OSZpeM3mIgXg5sIrp/37kz aWVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769699361; x=1770304161; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Wguw1Z3AM60JgnSGjoz0QuEW8gHEozBcW1RQJVnraA0=; b=f6dRiWl2mKcVwWCEfm4v+CADgtG6YesyGI7FIRuloJCgSgVhXoh9tAh4bH/b7USjmW pWipySnKTwu6WUNAja6IMEzmkWH2ZbTRBZpRfixWGq6X6FdW02OUFuhtSEzCuMTHsrpT McFDNDR+l/KDvh0om2m2/0hD5nAqRbOC9yn6GA+FUQj7Dk245kj3pzpElnlPuXlL/dGz /ZINEOCZFfHd1RG5VbdZG3o+/tpO5TAjRBJBPtX8LliMd4efE6SWMMfyKzhQAVDpbkEi FLVLK94FkOVW7DqVyDwvEjssWhj4iKEQoTCMtJ2ve8Gk/AYxyAwSH58BtnLaU/y5YqND u/kA== X-Forwarded-Encrypted: i=1; AJvYcCVxxwg7uQQLPQ1NFyMBd+ZnA5vWtMipqEg5hViccNfupXWfxiQBi2J/B9wYs8NIZOEViq1z0KMeDWeoKg==@lists.postgresql.org X-Gm-Message-State: AOJu0YwTSto1FG9yPVB4+Ki6CyqJo+b32A4ksjLZ3bYO1URgyIDInjcu ywEq35ZAlXlguSx1hSq7ZPbyVEtW6KHir0K1sY3Fa1eS8LJXRe6wDv7bD7Cmezm/rBpzfSQLKiu zzDfPcb+iQRgDBkKwnWEG9fsQi0gPMAM= X-Gm-Gg: AZuq6aKZg0IBY3zX33F7ta9/+bBV1uNdT9YB4x8BdQY+nFNOcTsn9jHnkppkUpLAARs oEw7C9sxWVyAwTv/6Uw21ffFxhQu2udsB2NU3hOAGU6maBaRJVZgn+6i3N7sE7/KjIndpLLw2B7 vHQCBD1t4qz4M8xDhrqNUqNet0KoBRPitzF3ZgqvqQnfzlH0Ew09PSXqA8gW7k9rkjSMWOBOaFf Prk2MLuZAqzYTyeaovHmqnbDueq8mTD45C1FESCwlqj9ZWjVUesb2AKcFCGUeBtAzPjQ+MG/bvg CJyeiTK9KqpXh+1XUGZCFAnGFi8d X-Received: by 2002:a05:690e:b4c:b0:649:4be:2071 with SMTP id 956f58d0204a3-6498fbf89ebmr7518015d50.24.1769699360641; Thu, 29 Jan 2026 07:09:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Alicja Kucharczyk Date: Thu, 29 Jan 2026 16:09:08 +0100 X-Gm-Features: AZwV_Qi3U0yIUJehj4RHuDf8Km5-zp-wt0LkFumUPT9a9Spfh3vx2uv4Vm6TkT4 Message-ID: Subject: Re: Setting huge_pages=off when HugePages are allocated in Linux? To: Laurenz Albe Cc: Ron Johnson , Pgsql-admin Content-Type: multipart/alternative; boundary="000000000000c0158c0649883dff" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c0158c0649883dff Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =C5=9Br., 28 sty 2026 o 18:02 Laurenz Albe napis= a=C5=82(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 =3D off" within PG and then restart PG, will Linu= x > see those 10475 HugePages as off-limits to normal 4KiB allocations? > > Yes. That's why it is a good idea to set "huge_pages =3D on" if you inte= nd > to use them with > PostgreSQL. Otherwise it may happen that PostgreSQL resorts to allocatin= g > 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=E2=80=99s basically the same story the other way around: if you set huge_pages =3D 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: =E2=80=9CWhile we need at least 3170 huge pages in this example, a larger s= etting would be appropriate if other programs on the machine also need huge pages.= =E2=80=9D I get what it=E2=80=99s trying to say (size for all consumers), but it can = read a bit like =E2=80=9Cmore is fine=E2=80=9D. On a dedicated PostgreSQL server, = =E2=80=9Cmore=E2=80=9D 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=E2=80=99t = get used for regular memory allocations, so it=E2=80=99s best to size them as close = to what you need as possible (especially on dedicated servers). regards, A.Kucharczyk --000000000000c0158c0649883dff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
=C5=9Br., 28 sty 2026 o 18:02=C2=A0Lauren= z Albe <laurenz.albe@cyberte= c.at> napisa=C5=82(a):
> In the example in this (quite helpful) Cybertec post,=C2=A010475 HugeP= ages are allocated.=C2=A0
> https://www.cybertec-postgresql.co= m/en/huge-pages-postgresql/
>
> If we set "huge_pages =3D off" within PG and then restart PG= , will Linux see those 10475 HugePages as off-limits to normal 4KiB allocat= ions?

Yes.=C2=A0 That's why it is a good idea to set "huge_pages =3D on&= quot; if you intend to use them with
PostgreSQL.=C2=A0 Otherwise it may happen that PostgreSQL resorts to alloca= ting 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=E2=80=99s basically the same story the other way around: if you = set huge_pages =3D 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:
=E2=80=9CWhile we need at least 3170 huge p= ages in this example, a larger setting would be appropriate if other progra= ms on the machine also need huge pages.=E2=80=9D

I get what it=E2=80= =99s trying to say (size for all consumers), but it can read a bit like =E2= =80=9Cmore is fine=E2=80=9D. On a dedicated PostgreSQL server, =E2=80=9Cmor= e=E2=80=9D is usually just wasted memory unless you actually have another h= ugepage user.

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

regards,
A= .Kucharczyk
--000000000000c0158c0649883dff--