Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Ostanevich via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] Linux/ARM64: Make mremap() non-moving due to VA space woes.
Date: Mon, 2 Aug 2021 18:55:19 +0300
Message-ID: <50245C6B-737F-4C11-B091-FAFDCD32506E@tarantool.org> (raw)
In-Reply-To: <YQgKdaxGgvnJ/j1D@root>

Hi!

Thanks for explanation, LGTM.


> On 2 Aug 2021, at 18:08, Sergey Kaplun <skaplun@tarantool.org> wrote:
> 
> Hi, Sergos!
> 
> Thanks for the review!
> 
> On 01.08.21, Sergey Ostanevich wrote:
>> Hi! Thanks for the patch!
>> 
>> Now direct_resize() will fail if it doesn't fit into the current place
>> with a new size and a direct_alloc() supposedly will be called. This one 
>> doesn't help with 47-bit address AFAIU since it has no extra option -
>> I doubt it exist at all - to ask kernel to fit.
>> 
>> So, how it helps?
> 
> For arm64 LJ_64 mode is enabled.
> It means LJ_ALLOC_MMAP_PROBE is defined and for each huge allocation
> `mmap_probe()` is called. This function tries several allocations
> unless the limit (30) is reached, or any suitable address is found.
> 
>> 
>> 
>> Regards,
>> Sergos
>> 
>> 
>>> On 1 Aug 2021, at 13:36, Igor Munkin <imun@tarantool.org> wrote:
>>> 
>>> Sergey,
>>> 
>>> Thanks for the fixes! LGTM, except the single typo.
>>> 
>>> On 28.07.21, Sergey Kaplun wrote:
>>> 
>>> <snipped>
>>> 
>>>> 
>>>> The new commit message is the following:
>>>> 
>>>> ===================================================================
>>>> Linux/ARM64: Make mremap() non-moving due to VA space woes.
>>>> 
>>>> This reduces overall performance on ARM64, but we have no choice.
>>>> Linux kernel default userspace VA is 48 bit, but we'd need 47 bit.
>>>> mremap() ignores address hints due to a kernel API issue. The mapping
>>>> may move to an undesired address which will cause an assert or crash.
>>>> 
>>>> Reported by Raymond W. Ko.
>>>> 
>>>> (cherry picked from commit 67dbec82f4f05a416a78a560a726553beaa7a223)
>>>> 
>>>> 47-bit VA space is required by LuaJIT for keeping a GC object pointer in
>>>> TValue. In case of huge blobs that are mapped directly, `mremap()` may
>>>> move the chunk out of 47-bit range of VA space on ARM64. `mremap()`
>>>> accepts the fifth argument (new address hint) only with MREMAP_FIXED
>>>> flag. In that case it unmaps any other mapping to specified address.
>>>> 
>>>> To avoid this behaviour this patch restricts `mremap()` to relocate
>>>> the mapping to a new virtual address by set CALL_MREMAP_NOMOVE flag
>>> 
>>> Typo: s/set/setting/.
>>> 
>>>> instead of CALL_MREMAP_MAYMOVE for arm64 architecture.
>>>> 
>>>> Sergey Kaplun:
>>>> * added the description and the test for the problem
>>>> 
>>>> Needed for tarantool/tarantool#6154
>>> 
>>> Minor: Why #5629 is not mentioned?
>>> 
>>>> ===================================================================
>>>> 
>>> 
>>> <snipped>
>>> 
>>>> 
>>>> -- 
>>>> Best regards,
>>>> Sergey Kaplun
>>> 
>>> -- 
>>> Best regards,
>>> IM
>> 
> 
> -- 
> Best regards,
> Sergey Kaplun


  reply	other threads:[~2021-08-02 15:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 17:40 [Tarantool-patches] [PATCH luajit 0/2] arm64: fix 48-bit addresses issues Sergey Kaplun via Tarantool-patches
2021-07-06 17:40 ` [Tarantool-patches] [PATCH luajit 1/2] Add support for full-range 64 bit lightuserdata Sergey Kaplun via Tarantool-patches
2021-07-27 13:59   ` Igor Munkin via Tarantool-patches
2021-07-28 12:29     ` Sergey Kaplun via Tarantool-patches
2021-08-01 10:36       ` Igor Munkin via Tarantool-patches
2021-08-02 14:56         ` Sergey Kaplun via Tarantool-patches
2021-08-01 16:25       ` Sergey Ostanevich via Tarantool-patches
2021-08-02 14:51         ` Sergey Kaplun via Tarantool-patches
2021-08-02 15:42           ` Igor Munkin via Tarantool-patches
2021-08-10 16:46           ` Sergey Ostanevich via Tarantool-patches
2021-08-11  5:54             ` Vitaliia Ioffe via Tarantool-patches
2021-07-06 17:40 ` [Tarantool-patches] [PATCH luajit 2/2] Linux/ARM64: Make mremap() non-moving due to VA space woes Sergey Kaplun via Tarantool-patches
2021-07-27 15:23   ` Igor Munkin via Tarantool-patches
2021-07-28 12:29     ` Sergey Kaplun via Tarantool-patches
2021-08-01 10:36       ` Igor Munkin via Tarantool-patches
2021-08-01 16:59         ` Sergey Ostanevich via Tarantool-patches
2021-08-02 15:08           ` Sergey Kaplun via Tarantool-patches
2021-08-02 15:55             ` Sergey Ostanevich via Tarantool-patches [this message]
2021-08-02 15:11         ` Sergey Kaplun via Tarantool-patches
2021-08-11  7:21 ` [Tarantool-patches] [PATCH luajit 0/2] arm64: fix 48-bit addresses issues Igor Munkin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50245C6B-737F-4C11-B091-FAFDCD32506E@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=skaplun@tarantool.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Tarantool development patches archive

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lists.tarantool.org/tarantool-patches/0 tarantool-patches/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 tarantool-patches tarantool-patches/ https://lists.tarantool.org/tarantool-patches \
		tarantool-patches@dev.tarantool.org.
	public-inbox-index tarantool-patches

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git