Re: AioCtl Shared Memory size fix

From: Andres Freund <andres(at)anarazel(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, "Madhukar (dot)" <madhukarprasad(at)google(dot)com>, pgsql-hackers(at)postgresql(dot)org, Vaibhav Jain <jainva(at)google(dot)com>, Sangeetha Seshadri <sangsesh(at)google(dot)com>, Noah Misch <nmisch(at)google(dot)com>
Subject: Re: AioCtl Shared Memory size fix
Date: 2025-09-16 23:32:02
Message-ID: 4b3elf3wj32l3o4qhvi4fkvipovhubuyb56xy2afesttikppki@favladkssh6q
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-09-16 15:50:20 +0900, Michael Paquier wrote:
> On Mon, Sep 15, 2025 at 02:06:03PM +0200, Matthias van de Meent wrote:
> > Presumably this was `PgAioHandle io_handles[]` at some point, but now
> > that it's a pointer it's a proper part of the struct's own size, and
> > should be treated as such for memory accounting.
>
> I would bet on a FLEXIBLE_ARRAY_MEMBER from a previous version..

Indeed. I don't remember for sure why I changed it, but I think it may have
been to make the different allocations more visible in pg_shmem_allocations.

> >> Please find a patch to account for io_handles member of PgAioCtl.
> >> The patch uses sizeof(PgAioCtl) instead of offsetof(PgAioCtl, io_handles) in AioCtlShmemSize.
> >
> > LGTM.
>
> Yep, will fix. Thanks for the report, the patch and the review, to
> both of you.

Thanks for finding and fixing!

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-09-16 23:42:29 Re: REPACK and naming
Previous Message Andres Freund 2025-09-16 23:25:10 Re: New string-truncation warnings from GCC 15