Re: remap the .text segment into huge pages at run time

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: remap the .text segment into huge pages at run time
Date: 2023-06-20 03:23:14
Message-ID: CAFBsxsESbu57taiRrK5NijATXeDG2woOH7bpK5o1K4GsO9MS4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 14, 2023 at 12:40 PM John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
wrote:
>
> On Sat, Nov 5, 2022 at 3:27 PM Andres Freund <andres(at)anarazel(dot)de> wrote:

> > A real version would have to open /proc/self/maps and do this for at
least
> > postgres' r-xp mapping. We could do it for libraries too, if they're
suitably
> > aligned (both in memory and on-disk).

> For the postmaster, it should be simple to have a function that just
takes the address of itself, then parses /proc/self/maps to find the
boundaries within which it lies. I haven't thought about libraries much.
Though with just the postmaster it seems that would give us the biggest
bang for the buck?

Here's a start at that, trying with postmaster only. Unfortunately, I get
"MADV_COLLAPSE failed: Invalid argument". I tried different addresses with
no luck, and also got the same result with a small standalone program. I'm
on ext4, so I gather I don't need "cp --reflink=never" but tried it anyway.
Configuration looks normal by "grep HUGEPAGE /boot/config-$(uname
-r)". Maybe there's something obvious I'm missing?

--
John Naylor
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v2-0002-Attmept-to-remap-the-.text-segment-into-huge-page.patch text/x-patch 5.8 KB
v2-0001-Align-loadable-segments-to-2MB-boundaries-on-Linu.patch text/x-patch 1.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2023-06-20 03:32:21 Re: [DOC] Update ALTER SUBSCRIPTION documentation v3
Previous Message Michael Paquier 2023-06-20 02:09:08 Re: run pgindent on a regular basis / scripted manner