Re: remap the .text segment into huge pages at run time - Mailing list pgsql-hackers

From John Naylor
Subject Re: remap the .text segment into huge pages at run time
Date
Msg-id CAFBsxsESbu57taiRrK5NijATXeDG2woOH7bpK5o1K4GsO9MS4A@mail.gmail.com
Whole thread Raw
In response to Re: remap the .text segment into huge pages at run time  (John Naylor <john.naylor@enterprisedb.com>)
Responses Re: remap the .text segment into huge pages at run time
List pgsql-hackers

On Wed, Jun 14, 2023 at 12:40 PM John Naylor <john.naylor@enterprisedb.com> wrote:
>
> On Sat, Nov 5, 2022 at 3:27 PM Andres Freund <andres@anarazel.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

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: run pgindent on a regular basis / scripted manner
Next
From: Peter Smith
Date:
Subject: Re: [DOC] Update ALTER SUBSCRIPTION documentation v3