From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: make LWLockCounter a global variable |
Date: | 2025-08-29 14:43:26 |
Message-ID: | aLG8jlpEZAseM-wk@nathan |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Aug 29, 2025 at 06:52:48AM +0000, Bertrand Drouvot wrote:
> On Thu, Aug 28, 2025 at 05:56:07PM -0400, Tom Lane wrote:
>> No objection here. As a small improvement, perhaps you could swap
>> around the code in LWLockShmemSize so that the order in which it
>> considers size contributions matches the physical layout, more
>> or less like
>>
>> [...]
>>
>> I find it a little confusing that that code doesn't line up
>> exactly with what CreateLWLocks does.
>
> +1.
Good idea. Here's a new version of the patch. If CI is happy with it,
I'll go ahead and commit it.
> Another option could be to not change CreateLWLocks() at all, except removing the
> local variable:
>
> @@ -423,7 +424,6 @@ CreateLWLocks(void)
> if (!IsUnderPostmaster)
> {
> Size spaceLocks = LWLockShmemSize();
> - int *LWLockCounter;
>
> to use the global variable. That way we preserve the current memory layout and
> there is no need to change LWLockShmemSize().
That would make the patch smaller, but IMHO it kind-of defeats the purpose,
which is to make this stuff simpler and easier to follow.
--
nathan
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Make-LWLockCounter-a-global-variable.patch | text/plain | 5.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-08-29 14:47:39 | Re: headerscheck warnings with late-model gcc |
Previous Message | cca5507 | 2025-08-29 14:40:25 | Unused parameter in ProcessSlotSyncInterrupts() |