Re: Fix rounding method used to compute huge pages

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix rounding method used to compute huge pages
Date: 2026-01-22 23:04:29
Message-ID: aXKs_Y4NucBznm0j@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 22, 2026 at 03:24:13PM -0600, Nathan Bossart wrote:
> Oops, it looks like this is my fault. I doubt this causes any practical
> problems, but we might as well fix it.

And it's something I have committed.

> + 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);

FWIW, we have always been kind of sloppy with slightly overestimating
the shmem size required in the backend code, and here it's just a one.
I don't see a strong need for a backpatch here. Of course, no
objections in adjusting that on HEAD. Nathan, you are planning to
take care of that as original author? This should fall under my
bucket as original committer, but as you were an author, feel free to
take priority here of course.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-01-22 23:08:02 Re: Add WALRCV_CONNECTING state to walreceiver
Previous Message Sami Imseih 2026-01-22 22:59:39 Re: Optional skipping of unchanged relations during ANALYZE?