Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jemalloc don't works on 16KB page kernel #2180

Closed
12101111 opened this issue Apr 14, 2022 · 2 comments
Closed

jemalloc don't works on 16KB page kernel #2180

12101111 opened this issue Apr 14, 2022 · 2 comments
Labels
enhancement An enhancement to the functionality of the software. wontfix A feature or bug that is unlikely to be implemented or fixed.

Comments

@12101111
Copy link

12101111 commented Apr 14, 2022

What version of ripgrep are you using?

13.0.0

How did you install ripgrep?

Gentoo: emerge sys-apps/ripgrep

What operating system are you using ripgrep on?

Gentoo Base System release 2.8 aarch64
Apple MacBook Pro (16-inch, M1 Max, 2021)
Linux 5.17.0-rc7-asahi-next-20220310+

Describe your bug.

<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 5 bytes failed
zsh: abort (core dumped)  rg a

What are the steps to reproduce the behavior?

Built ripgrep on 4K page kernel, and run it on 16KB page kernel

What is the actual behavior?

It crash.

What is the expected behavior?

Many other malloc implementation does work on 16KB kernel and is better than jemaloc in code size and performance, such as mimalloc or rpmalloc.

See also: https://github.com/AsahiLinux/docs/wiki/Software-known-to-have-issues-with-16k-page-size

@BurntSushi
Copy link
Owner

This is ripgrep's tracker, not jemalloc's. I think you need to report this issue there.

The best work-around for you at the moment is probably to build ripgrep without jemalloc. Currently, jemalloc is only used when building for Linux with musl as the libc. Otherwise, it uses the system allocator.

You could, for example, remove:

ripgrep/Cargo.toml

Lines 59 to 60 in ced5b92

[target.'cfg(all(target_env = "musl", target_pointer_width = "64"))'.dependencies.jemallocator]
version = "0.3.0"

and remove:

#[cfg(all(target_env = "musl", target_pointer_width = "64"))]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

And then ripgrep should use whatever system allocator you have setup via your glibc. You might have perf regressions though. glibc's allocator has been fine in my experiments, but musl's has had noticeable perf problems.

@BurntSushi BurntSushi added enhancement An enhancement to the functionality of the software. wontfix A feature or bug that is unlikely to be implemented or fixed. labels Apr 14, 2022
@teohhanhui
Copy link

Looks like jemalloc just needs to be configured with --with-lg-page to support 16K page size.

This can be achieved by setting the environment variable:

JEMALLOC_SYS_WITH_LG_PAGE=14 (16K page size)

Or to support 64K page size as well:

JEMALLOC_SYS_WITH_LG_PAGE=16 (64K page size)

In either case, it'd still work for 4K/16K(/64K) page sizes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement to the functionality of the software. wontfix A feature or bug that is unlikely to be implemented or fixed.
Projects
None yet
Development

No branches or pull requests

3 participants