Re: Large Pages and Super Pages for PostgreSQL

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: DEVOPS_WwIT <devops(at)ww-it(dot)cn>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, ZHU XIAN WEN <tony(dot)zhu(at)ww-it(dot)cn>
Subject: Re: Large Pages and Super Pages for PostgreSQL
Date: 2022-01-16 07:32:17
Message-ID: CA+hUKGJqrMAz4XZVWBMpCzyGmHZyCGR+nJy6BbzQsr7-1cQ=bA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jan 16, 2022 at 6:03 PM DEVOPS_WwIT <devops(at)ww-it(dot)cn> wrote:
> Solaris and FreeBSD supports large/super pages, and can be used
> automatically by applications.
>
> Seems Postgres can't use the large/super pages on Solaris and FreeBSD
> os(I think can't use the large/super page HPUX and AIX), is there anyone
> could take a look?

Hello,

I can provide some clues and partial answers about page size on three
of the OSes you mentioned:

1. Solaris: I haven't used that OS for a long time, but I thought it
was supposed to promote memory to larger pages sizes transparently
with some heuristics. To control page size explicitly, it *looks*
like memcntl(2) with command MHA_MAPSIZE_VA could be used; that's what
the man page says, anyway. If someone is interested in writing a
patch to do that, I'd be happy to review it and test it on illumos...

2. AIX: We *nearly* made this work recently[1]. The summary is that
AIX doesn't have a way to control the page size of anonymous shared
mmap memory (our usual source of shared memory), so you have to use
SystemV shared memory if you want non-default page size for shared
memory. We got as far as adding the option shared_memory_type=sysv,
and the next step is pretty easy: just pass in some magic flags. This
just needs someone with access and motivation to pick up that work...

3. FreeBSD: FreeBSD does transparently migrate PostgreSQL memory to
"super" pages quite well in my experience, but there is also a new
facility in FreeBSD 13 to ask for specific page sizes explicitly. I
wrote a quick and dirty patch to enable PostgreSQL's huge_pages and
huge_page_size settings to work with that interface, but I haven't yet
got as far as testing it very hard or proposing it... but here it is,
if you like experimental code[2].

I don't know about HP-UX. I think it might be dead, Jim.

[1] https://www.postgresql.org/message-id/flat/HE1PR0202MB28126DB4E0B6621CC6A1A91286D90%40HE1PR0202MB2812.eurprd02.prod.outlook.com
[2] https://github.com/macdice/postgres/commit/a71aafe5582c2e61005af0d16ca82eed89445a67

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-01-16 09:19:30 Re: XLogReadRecord() error in XlogReadTwoPhaseData()
Previous Message Noah Misch 2022-01-16 07:12:10 Re: XLogReadRecord() error in XlogReadTwoPhaseData()