public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nathan Bossart <[email protected]>
To: Anthonin Bonnefoy <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Fix rounding method used to compute huge pages
Date: Thu, 22 Jan 2026 15:24:13 -0600
Message-ID: <aXKVfaTntXRn1V0m@nathan> (raw)
In-Reply-To: <CAO6_Xqq2vZbva0R9eQSY0p2kfksX2aP4r=+Z_q1HBYNU=m8bBg@mail.gmail.com>
References: <CAO6_Xqq2vZbva0R9eQSY0p2kfksX2aP4r=+Z_q1HBYNU=m8bBg@mail.gmail.com>
On Thu, Jan 22, 2026 at 05:42:44PM +0100, Anthonin Bonnefoy wrote:
> When computing the dynamic value of shared_memory_size_in_huge_pages,
> (1+size_b/hp_size) is currently used. This works when size_b is not
> divisible by hp_size. However, it will yield an additional huge page
> when size_b is divisible by hp_size.
Oops, it looks like this is my fault. I doubt this causes any practical
problems, but we might as well fix it.
+ if (size_b % hp_size != 0)
+ size_b = add_size(size_b, hp_size - (size_b % hp_size));
+ hp_required = size_b / hp_size;
I think we could simplify this a tad:
hp_required = size_b / hp_size;
if (size_b % hp_size != 0)
hp_required = add_size(hp_required, 1);
> 0002: This patch uses add_size in CreateAnonymousSegment when the
> allocation size is rounded up, to check for possible overflow.
Seems reasonable.
--
nathan
view thread (7+ messages) latest in thread
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]
Subject: Re: Fix rounding method used to compute huge pages
In-Reply-To: <aXKVfaTntXRn1V0m@nathan>
* 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