On Mon, Sep 14, 2026 at 03:19:03PM +0800, Chao Li wrote:
> This is a small issue, but it has been there for many years.
> CalculateShmemSize() has logic to round size to a multiple of a typical
> page size:
> ```
>       /* might as well round it off to a multiple of a typical page size */
>       size = add_size(size, 8192 - (size % 8192));
> ```
> 
> When size is already a multiple of 8192, this add_size() call is not
> needed; it only results in an extra 8192 bytes being allocated in shared
> memory. The fix is simple:
> ```
>       if (size % 8192 != 0)
>               /* might as well round it off to a multiple of a typical page 
> size */
>               size = add_size(size, 8192 - (size % 8192));
> ```

IMHO the current code is fine and is unlikely to cause problems for users.

-- 
nathan


Reply via email to