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

From: Andres Freund <andres(at)anarazel(dot)de>
To: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
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-21 03:41:59
Message-ID: 20230621034159.bq4xy3sj6qb5oofi@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-06-21 09:35:36 +0700, John Naylor wrote:
> On Wed, Jun 21, 2023 at 12:46 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> >
> > Hi,
> >
> > On 2023-06-20 10:29:41 -0700, Andres Freund wrote:
> > > On 2023-06-20 10:23:14 +0700, John Naylor wrote:
> > > > Here's a start at that, trying with postmaster only. Unfortunately, I
> get
> > > > "MADV_COLLAPSE failed: Invalid argument".
> > >
> > > I also see that. But depending on the steps, I also see
> > > MADV_COLLAPSE failed: Resource temporarily unavailable
> > >
> > > I suspect there's some kernel issue. I'll try to ping somebody.
> >
> > Which kernel version are you using? It looks like the issue I am hitting
> might
> > be specific to the in-development 6.4 kernel.
>
> (Fedora 38) uname -r shows
>
> 6.3.7-200.fc38.x86_64

FWIW, I bisected the bug I was encountering.

As far as I understand, it should not affect you, it was only merged into
6.4-rc1 and a fix is scheduled to be merged into 6.4 before its release. See
https://lore.kernel.org/all/ZJIWAvTczl0rHJBv(at)x1n/

So I am wondering if you're encountering a different kind of problem. As I
mentioned, I have observed that the pages need to be clean for this to
work. For me adding a "sync path/to/postgres" makes it work on 6.3.8. Without
the sync it starts to work a while later (presumably when the kernel got
around to writing the data back).

without sync:

self: 0x563b2abf0a72 start: 563b2a800000 end: 563b2afe3000
old advlen: 7e3000
new advlen: 800000
MADV_COLLAPSE failed: Invalid argument

with sync:
self: 0x555c947f0a72 start: 555c94400000 end: 555c94be3000
old advlen: 7e3000
new advlen: 800000

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-06-21 03:49:20 Re: could not extend file "base/5/3501" with FileFallocate(): Interrupted system call
Previous Message Tom Lane 2023-06-21 03:39:31 Re: [PATCH] hstore: Fix parsing on Mac OS X: isspace() is locale specific