git: b90d68c9b28b - stable/14 - jemalloc: set LG_VADDR to 64 on amd64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 15 Oct 2024 15:07:09 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b90d68c9b28b0a458bdf4a963397817974ed0f90 commit b90d68c9b28b0a458bdf4a963397817974ed0f90 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-09-16 21:09:03 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-10-15 15:06:44 +0000 jemalloc: set LG_VADDR to 64 on amd64 (cherry picked from commit eade2001aa9d91440886de8359a4dec9edcde2a9) --- contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h | 4 ++++ lib/libc/stdlib/malloc/jemalloc/Makefile.inc | 3 +++ share/mk/src.opts.mk | 1 + tools/build/options/WITHOUT_JEMALLOC_LG_VADDR_WIDE | 5 +++++ 4 files changed, 13 insertions(+) diff --git a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h index ea8e8d42b14e..493300157a70 100644 --- a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h +++ b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h @@ -39,7 +39,11 @@ # define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec"))) #endif #ifdef __amd64__ +#ifdef _USE_LG_VADDR_WIDE +# define LG_VADDR 64 +#else # define LG_VADDR 48 +#endif # define LG_SIZEOF_PTR 3 # define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec"))) #endif diff --git a/lib/libc/stdlib/malloc/jemalloc/Makefile.inc b/lib/libc/stdlib/malloc/jemalloc/Makefile.inc index 1ba7725fe8a8..d916d69f471f 100644 --- a/lib/libc/stdlib/malloc/jemalloc/Makefile.inc +++ b/lib/libc/stdlib/malloc/jemalloc/Makefile.inc @@ -5,6 +5,9 @@ JEMALLOCSRCS:= jemalloc.c arena.c background_thread.c base.c bin.c bitmap.c \ test_hooks.c ticker.c tsd.c witness.c CFLAGS+=-I${SRCTOP}/contrib/jemalloc/include +.if ${MK_JEMALLOC_LG_VADDR_WIDE} != no +CFLAGS+=-D_USE_LG_VADDR_WIDE +.endif .for src in ${JEMALLOCSRCS} MISRCS+=jemalloc_${src} diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 600daa9ef61b..774b6fffd3df 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -118,6 +118,7 @@ __DEFAULT_YES_OPTIONS = \ IPFW \ ISCSI \ JAIL \ + JEMALLOC_LG_VADDR_WIDE \ KDUMP \ KVM \ LDNS \ diff --git a/tools/build/options/WITHOUT_JEMALLOC_LG_VADDR_WIDE b/tools/build/options/WITHOUT_JEMALLOC_LG_VADDR_WIDE new file mode 100644 index 000000000000..9efc4022e9cf --- /dev/null +++ b/tools/build/options/WITHOUT_JEMALLOC_LG_VADDR_WIDE @@ -0,0 +1,5 @@ +Disallow programs to use more than 48 address bits on amd64. +Incompatible with LA57 mode. +Enabling this option might result in a slight reduction in memory +consumption for jemalloc metadata, but also requires disabling LA57 +(if hardware supports it).