Re: Large Pages and Super Pages for PostgreSQL - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Large Pages and Super Pages for PostgreSQL
Date
Msg-id CA+hUKGJqrMAz4XZVWBMpCzyGmHZyCGR+nJy6BbzQsr7-1cQ=bA@mail.gmail.com
Whole thread Raw
In response to Large Pages and Super Pages for PostgreSQL  (DEVOPS_WwIT <devops@ww-it.cn>)
Responses Re: Large Pages and Super Pages for PostgreSQL
List pgsql-hackers
On Sun, Jan 16, 2022 at 6:03 PM DEVOPS_WwIT <devops@ww-it.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



pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: MultiXact/SLRU buffers configuration
Next
From: Thomas Munro
Date:
Subject: Re: XLogReadRecord() error in XlogReadTwoPhaseData()