Re: Improve logging when using Huge Pages

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, sfrost(at)snowman(dot)net, alvherre(at)alvh(dot)no-ip(dot)org, andres(at)anarazel(dot)de, nathandbossart(at)gmail(dot)com, jchampion(at)timescale(dot)com, john(dot)naylor(at)enterprisedb(dot)com, masao(dot)fujii(at)oss(dot)nttdata(dot)com, noriyoshi(dot)shinoda(at)hpe(dot)com, pgsql-hackers(at)postgresql(dot)org, rjuju123(at)gmail(dot)com, sawada(dot)mshk(at)gmail(dot)com, tgl(at)sss(dot)pgh(dot)pa(dot)us, thomas(dot)munro(at)gmail(dot)com
Subject: Re: Improve logging when using Huge Pages
Date: 2023-03-22 22:18:28
Message-ID: ZBt+tCS/Akj8BvHi@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 22, 2023 at 04:37:01PM +0900, Michael Paquier wrote:
> I have noted something.. For the WIN32 case, we have that:
>
> +++ b/src/backend/port/win32_shmem.c
> @@ -327,6 +327,8 @@ retry:
> Sleep(1000);
> continue;
> }
> +
> + huge_pages_active = ((flProtect & SEC_LARGE_PAGES) != 0);
> break;
>
> Are you sure that this is correct? This is set in
> PGSharedMemoryCreate(), part of CreateSharedMemoryAndSemaphores() in
> the startup sequence that creates the shmem segment. However, for a
> normal backend created by EXEC_BACKEND, SubPostmasterMain() reattaches
> to an existing shared memory segment, so we don't go through the
> creation path that would set huge_pages_active for the process just
> started, (note that InitPostmasterChild() switches IsUnderPostmaster,
> bypassing the shmem segment creation).

Wow, good point. I think to make it work we'd need put
huge_pages_active into BackendParameters and handle it in
save_backend_variables(). If so, that'd be strong argument for using a
GUC, which already has all the necessary infrastructure for exposing the
server's state.

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-03-22 22:23:28 Re: Improve logging when using Huge Pages
Previous Message Andres Freund 2023-03-22 22:07:57 Re: HOT chain validation in verify_heapam()