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
Unknown Object (File)
Thu, Nov 7, 12:45 PM
Unknown Object (File)
Thu, Nov 7, 12:42 AM
Unknown Object (File)
Tue, Nov 5, 8:51 AM
Unknown Object (File)
Fri, Nov 1, 2:15 AM
Unknown Object (File)
Thu, Oct 31, 6:23 AM
Unknown Object (File)
Wed, Oct 30, 9:23 AM
Unknown Object (File)
Fri, Oct 25, 10:51 PM
Unknown Object (File)
Wed, Oct 23, 6:22 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 Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #143473)
kib marked an inline comment as done.

Fix grammar in the option' description.

share/mk/src.opts.mk
371–374

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.