Re: Calling PGReserveSemaphores() from CreateOrAttachShmemStructs - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Calling PGReserveSemaphores() from CreateOrAttachShmemStructs
Date
Msg-id CAExHW5u0uaLY1ziuuQmRwseJACqS0S=jBtzWLPvGV9gJe2dAKg@mail.gmail.com
Whole thread Raw
In response to Re: Calling PGReserveSemaphores() from CreateOrAttachShmemStructs  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
On Thu, Nov 6, 2025 at 6:16 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>
> On 31/10/2025 19:11, Heikki Linnakangas wrote:
> > On 26/08/2025 10:11, Ashutosh Bapat wrote:
> >> On Mon, Aug 25, 2025 at 3:11 PM Thomas Munro <thomas.munro@gmail.com>
> >> wrote:
> >>>
> >>> On Mon, Aug 25, 2025 at 9:10 PM Ashutosh Bapat
> >>> <ashutosh.bapat.oss@gmail.com> wrote:
> >>>> Is this change correct? Was there any reason to leave it like that in
> >>>> e25626677f8076eb3ce94586136c5464ee154381? Or was it just something
> >>>> that didn't fit in that commit?
> >>>
> >>> We/I just missed that opportunity when ripping that stuff out.  It
> >>> sounds like we might need a comment-only patch to back-patch to 18
> >>> that would say something like "this is done here for historical
> >>> reasons" so as not to confuse people with obsolete nonsense, and a
> >>> follow up patch for master to do things in a more straightforward way
> >>> as you said.
> >>
> >> Thanks for the confirmation.
> >>
> >> Attached patchset has two patches
> >> 0001 - backpatchable, adds the comment.
> >> 0002 - actual code changes for master. The changes are described in
> >> the commit message in detail. I think ProcGlobalSemas() too, can be
> >> converted into a macro or can be declared static inline, but I haven't
> >> done so. I think it eliminates all the asymmetric handling of
> >> semaphores.
> >>
> >>>
> >>>> If the change looks safe and useful, I will create CF entry for it so
> >>>> that the patch gets tested on all platforms, and thus with different
> >>>> definitions of PGReserveSemaphores().
> >>>
> >>> +1, will review, thanks!
> >>
> >> Added a CF entry so that CI tests the changes on many platforms.
> >> https://commitfest.postgresql.org/patch/5997/
> >
> > Looks good to me. I can commit this, but since Thomas said he'd review
> > it, I'll give him a few days for that if he finds the time.
>
> Committed with minor changes: I made the comments a little less
> detailed,

> updated the comment above CalculateShmemSize() now that it
> doesn't have the 'num_semaphores' argument anymore,

sorry for missing this.

> and made
> ShmemAllocUnlocked static. Thanks!

Thanks a lot. Helps me with shared buffer resizing patches.

--
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Mats Kindahl
Date:
Subject: Re: Refactor StringInfo usage in subscriptioncmds.c
Next
From: "Euler Taveira"
Date:
Subject: Re: log_min_messages per backend type