Page MenuHomeFreeBSD

jemalloc: set LG_VADDR to 64 on amd64
ClosedPublic

Authored by kib on Sep 16 2024, 11:10 PM.
Tags
None
Referenced Files
F106637890: D46686.diff
Fri, Jan 3, 4:00 AM
Unknown Object (File)
Nov 30 2024, 2:58 PM
Unknown Object (File)
Nov 29 2024, 8:09 AM
Unknown Object (File)
Nov 28 2024, 10:40 PM
Unknown Object (File)
Nov 24 2024, 1:32 PM
Unknown Object (File)
Nov 24 2024, 7:58 AM
Unknown Object (File)
Nov 23 2024, 11:18 AM
Unknown Object (File)
Nov 23 2024, 11:18 AM
Subscribers

Details

Summary

The current value 48 causes immediate breakage on la57 kernels. In principle, the value can be increased to 57, but I do not see a reason.

With this change, and the series of fixes to the trampoline, I can boot la57 on real hardware.

PS. Arm64 would need a similar fix.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Sep 16 2024, 11:10 PM

I don't think you'll see any difference between 57 and 64.

It looks like LG_VADDR is used to decide which bits in an internal pointer can be reused. On arm64 if the value is at most 56 then RTREE_LEAF_COMPACT is defined so parts of the pointer are reused, if it's 57 then it's not and struct rtree_leaf_elm_s pulls the index and slab bit out.

On arm64 the value could be 52 for when FEAT_LPA2 is implemented.

Do you see any performance or memory usage change with this?

I don't think you'll see any difference between 57 and 64.

It looks like LG_VADDR is used to decide which bits in an internal pointer can be reused. On arm64 if the value is at most 56 then RTREE_LEAF_COMPACT is defined so parts of the pointer are reused, if it's 57 then it's not and struct rtree_leaf_elm_s pulls the index and slab bit out.

On arm64 the value could be 52 for when FEAT_LPA2 is implemented.

Do you see any performance or memory usage change with this?

Machine which I have is unusable for any perf work (BIOS is too broken). Perhaps I should add an option for small/large jemalloc VADDR. default to large?

kib added a reviewer: emaste.

Add build option to revert back to 48 bit wide.

tools/build/options/WITH_LG_VADDR_WIDE
3
kib marked an inline comment as done.

Fix grammar in the option' description.

share/mk/src.opts.mk
365–368

I don't think we generally have options that have a default on one arch and do not exist on other archs, ping @imp

What does make makeman think of this?

This will presumably be coming to at least arm64 as well it seems, and I imagine we should just have a MI on-by-default option for it.

Rename option to JEMALLOC_LG_ADDR_WIDE
Make it MI, with the only effect on amd64.

Ping? This is the last bit to restore LA57.

If JEMALLOC_LG_VADDR_WIDE is default YES we need a WITHOUT_JEMALLOC_LG_VADDR_WIDE description - src.conf documents the non-default setting. Otherwise LGTM.

This revision is now accepted and ready to land.Sep 26 2024, 3:54 PM

WITH->WITHOUT, edit the description.

This revision now requires review to proceed.Sep 26 2024, 5:12 PM
This revision is now accepted and ready to land.Sep 26 2024, 6:17 PM
This revision was automatically updated to reflect the committed changes.