Skip to content

nix: fix jemalloc on 16k pages#1759

Merged
saghen merged 1 commit into
saghen:mainfrom
alexandru0-dev:main
May 13, 2025
Merged

nix: fix jemalloc on 16k pages#1759
saghen merged 1 commit into
saghen:mainfrom
alexandru0-dev:main

Conversation

@alexandru0-dev
Copy link
Copy Markdown
Contributor

update fenix input flake and add rust-jemalloc-sys to buildInputs to support 16k pages (like on asahi linux)

@saghen
Copy link
Copy Markdown
Owner

saghen commented May 13, 2025

Would it make sense to only include rust-jemalloc-sys on systems that require it, maybe by checking getconf PAGESIZE?

@alexandru0-dev
Copy link
Copy Markdown
Contributor Author

Would it make sense to only include rust-jemalloc-sys on systems that require it, maybe by checking getconf PAGESIZE?

Idk tbh, I was basing myself from patches sent to nixpkgs upstream and how they deal with it

I'm happy to experiment tho

@saghen
Copy link
Copy Markdown
Owner

saghen commented May 13, 2025

Yeah, that'd be great! rust-jemalloc-sys is 46MiBs so it'd be nice to avoid it when we don't need it

~> nix-build -A rust-jemalloc-sys '<nixpkgs>'
~> nix path-info -Sh ./result
/nix/store/kxknc3j9nc03via3gafi4a3kanraa723-jemalloc-5.3.0	 46.0 MiB

@alexandru0-dev
Copy link
Copy Markdown
Contributor Author

maybe by checking getconf PAGESIZE?

You can't really do that it in packages

Maybe a flag that can enable it and so you have 2 builds?

Or you could check if the platform is aarch64 and only include it on that as it seems the only platform where pages can be different from 4k

@saghen
Copy link
Copy Markdown
Owner

saghen commented May 13, 2025

Yeah, looks like there's some work on implementing it: NixOS/nix#12446

Checking if the system is aarch64 works for me for now. I'll revisit this when support has been added upstream for checking the page size

@alexandru0-dev
Copy link
Copy Markdown
Contributor Author

Yeah, looks like there's some work on implementing it: NixOS/nix#12446

Yeah support in needed in the nix core, so until then...

Checking if the system is aarch64 works for me for now.

Perfect, I will update the PR then

I'll revisit this when support has been added upstream for checking the page size

I will look into the PR later, but it seems to me like it's something that needs also to be dealt even for older versions of nix

includes update to fenix inputs flake
@saghen saghen merged commit ef037d0 into saghen:main May 13, 2025
3 checks passed
@saghen
Copy link
Copy Markdown
Owner

saghen commented May 13, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants