| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Fix rounding method used to compute huge pages |
| Date: | 2026-01-22 21:24:13 |
| Message-ID: | aXKVfaTntXRn1V0m@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matheus Alcantara | 2026-01-22 21:40:46 | Re: [PATCH] llvmjit: always add the simplifycfg pass |
| Previous Message | Ilia Evdokimov | 2026-01-22 21:22:04 | Re: Optional skipping of unchanged relations during ANALYZE? |