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


Reply via email to