From nobody Thu Sep 26 23:17:45 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XF8dk1v3Xz5X9Ct; Thu, 26 Sep 2024 23:17:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XF8dk1Jqkz4VnW; Thu, 26 Sep 2024 23:17:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727392666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dO7FcmIKjyul1h8O4/U1jdHemSS0B9Nf3HtBV6VGGpU=; b=x+fc3oPM0xF0Nwd8VsosuTchL9UL9p5eUhADihf6FqzMsKPlkfjAFC0vHTkRq6tdpoj21Q x2oqVCggw+DbYlnozqDUTDxVup7g7NF9Jy2LQefeAg3hkQ45e2usUjN7C0tkdBYfFEeM9E kEAipXv3TVvt2MSb/HTdUs0V8yYmalmpug8KiCBDvfYilJfYxMvpRE5YM0yDw3GrGla5wh /7kswSjneh06oQQMW1jd6UZsElniMUTv3vau2assmARY3Z8IGOX+COBquMP4Vh5z14q8Ga 6dR3LrG0ve34uT1GW8Ybq/rCqUyU/aF1VYMkd+X3iPGZtky1VWCOtoyMHg2lJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727392666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dO7FcmIKjyul1h8O4/U1jdHemSS0B9Nf3HtBV6VGGpU=; b=C3bfOCDdXqfS5mcwi8ZBUkRB3rQD+Z+G8w0Ny1UzpSC0ubLei47sC3X169H5Vg+SQIqsyL kenkR/1wPXgS87/S5Tg3nxnVc5qBJacs6ZW65f9qLwkRYq3XIdhNW2Lo1zKG39tzNCZ2tT csaJYE3CrbQusWy2pYOeH607P/EJ+8Ahz64vVoMXJC4dYYg5Ihz/jYIV9s4KqExPhvYhVt hM8bM9eC+go2vSiSq0rNUH9+nT7n6167Wfld9+no26PyFetOMWsKAXw/1JGSdqiB8ayWI3 0ygldjDegiBg+cSPlwPZKremJ/v39Jf/mk4RM6xVuTnglycFb5csBjP20p/GVQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727392666; a=rsa-sha256; cv=none; b=hXlSqViwSDaqzVre7Nv9wrqgcTniyW0RI8+tIGqc8lY4Tq6QAZMLotKZ57btKXmltQqmeq +sniniPy1HEuBeWLc5Y0Ha6kB7WrLfjqr+UzDhQdrOw3RoxVM/TcEZSB5XkiLBldf5fNnc 2/gvu5N0PU96572+nYTF7ovJL0/kWO2sjDVdEILm38FAQ9x11yKK7w+LaJxqzCB4H/dweZ qfSsMikrKYyPbRW01yaS2pt1ePMkzuVe98jlb5DkrDlCVLrwdt8upM1Boc8QGWCvSXaAx5 kLV7kq7F+tT+rpG2AnXE6eqxWUM9n/bvRqraUKDYGidnyfzvGEW8bn4tFHY9Zw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XF8dk0Y2CzFx1; Thu, 26 Sep 2024 23:17:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48QNHjAB099747; Thu, 26 Sep 2024 23:17:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48QNHjUR099744; Thu, 26 Sep 2024 23:17:45 GMT (envelope-from git) Date: Thu, 26 Sep 2024 23:17:45 GMT Message-Id: <202409262317.48QNHjUR099744@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: eade2001aa9d - main - jemalloc: set LG_VADDR to 64 on amd64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eade2001aa9d91440886de8359a4dec9edcde2a9 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eade2001aa9d91440886de8359a4dec9edcde2a9 commit eade2001aa9d91440886de8359a4dec9edcde2a9 Author: Konstantin Belousov AuthorDate: 2024-09-16 21:09:03 +0000 Commit: Konstantin Belousov CommitDate: 2024-09-26 22:54:25 +0000 jemalloc: set LG_VADDR to 64 on amd64 and allow to revert it back to 48 with WITHOUT_JEMALLOC_LG_VADDR_WIDE build option. Reviewed by: andrew, emaste Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46686 --- 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 dee4679838d8..e733906bc146 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 f9d94ab663b0..95801cdeecc5 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -116,6 +116,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).