Skip to contentSkip to conversation

jemalloc: add new recipe

PATCH In review [email protected] 2 participants 8 messages Oct 26, 2021

lore
Share & tools
lore
#5 lore raw

PATCH 6/7 jemalloc: improve reproducibility

In reply to [email protected]

From: Mingli Yu <[email protected]>

Remove build host info from config file to improve reproducibility.

---
 meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb | 6 ++++++
 1 file changed, 6 insertions(+)
meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb +6 -0
index b5d53bb11..d4fed864d 100644
@@ -28,6 +28,12 @@ EXTRA_AUTORECONF += "--exclude=autoheader"
 
 EXTRA_OECONF:append:libc-musl = " --with-jemalloc-prefix=je_"
 
+do_install:append() {
+	sed -i -e 's@${STAGING_DIR_HOST}@@g' \
+               -e 's@${STAGING_DIR_NATIVE}@@g' \
+               -e 's@${WORKDIR}@@g' ${D}${bindir}/jemalloc-config
+}
+
 do_compile_ptest() {
 	oe_runmake tests
 }
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/7 jemalloc: Fix build on musl

In reply to [email protected]

From: Khem Raj <[email protected]>

Fixes
In file included from include/jemalloc/internal/jemalloc_preamble.h:21:
include/jemalloc/internal/../jemalloc.h:235:28: error: exception specification in declaration does not match previous declaration
void JEMALLOC_NOTHROW *je_aligned_alloc(size_t alignment,
^

---
 meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb +2 -0
index 4738f0e78..39637663f 100644
@@ -22,3 +22,5 @@ S = "${WORKDIR}/git"
 inherit autotools
 
 EXTRA_AUTORECONF += "--exclude=autoheader"
+
+EXTRA_OECONF:append:libc-musl = " --with-jemalloc-prefix=je_"
Signature · 1 line
2.17.1
#0 lore raw

PATCH 1/7 jemalloc: add new recipe

From: Mingli Yu <[email protected]>

jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support.

---
 .../jemalloc/jemalloc_5.2.1.bb                | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb
meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb new file +24 -0
new file mode 100644
index 000000000..4738f0e78
@@ -0,0 +1,24 @@
+# Copyright (C) 2021 Mingli Yu <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "General-purpose scalable concurrent malloc implementation"
+
+DESCRIPTION = "jemalloc is a general purpose malloc(3) implementation that emphasizes \
+fragmentation avoidance and scalable concurrency support."
+
+HOMEPAGE = "https://github.com/jemalloc/jemalloc"
+LICENSE = "BSD"
+
+SECTION = "libs"
+
+LIC_FILES_CHKSUM = "file://README;md5=6900e4a158982e4c4715bf16aa54fa10"
+
+SRC_URI = "git://github.com/jemalloc/jemalloc.git"
+
+SRCREV = "ea6b3e973b477b8061e0076bb257dbd7f3faa756"
+
+S = "${WORKDIR}/git"
+
+inherit autotools
+
+EXTRA_AUTORECONF += "--exclude=autoheader"
Signature · 1 line
2.17.1
#4 lore raw

PATCH 5/7 jemalloc: improve the ptest output

From: Mingli Yu <[email protected]>

Previouly we only show the output of each text program, actually each test program includes serveral test cases. Improve the ptest script to show the output of each test case.

Before:

 # ./run-ptest
 [snip]
 PASS: tests/integration/MALLOCX_ARENA
 PASS: tests/integration/aligned_alloc
 [snip]

After:

 # ./run-ptest
 [snip]
 PASS: test_MALLOCX_ARENA (non-reentrant)
 PASS: test_MALLOCX_ARENA (libc-reentrant)
 PASS: test_MALLOCX_ARENA (arena_new-reentrant)
 PASS: test_alignment_errors (non-reentrant)
 PASS: test_alignment_errors (libc-reentrant)
 PASS: test_alignment_errors (arena_new-reentrant)
 PASS: test_oom_errors (non-reentrant)
 PASS: test_oom_errors (libc-reentrant)
 PASS: test_oom_errors (arena_new-reentrant)
 PASS: test_alignment_and_size (non-reentrant)
 PASS: test_alignment_and_size (libc-reentrant)
 PASS: test_alignment_and_size (arena_new-reentrant)
 PASS: test_zero_alloc (non-reentrant)
 PASS: test_zero_alloc (libc-reentrant)
 PASS: test_zero_alloc (arena_new-reentrant)
 [snip]
---
 .../recipes-devtools/jemalloc/files/run-ptest    | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
meta-oe/recipes-devtools/jemalloc/files/run-ptest +9 -7
index ea9d80cbb..b351f947e 100644
@@ -5,13 +5,15 @@ for dir in tests/* ; do
 	cd $dir
 	for atest in * ; do
 		if [ \( -x $atest \) -a \( -f $atest \) ] ; then
-			./$atest > ${atest}.stdout 2> ${atest}.stderr
-			if [ $? = 0 ] ; then
-				echo "PASS: $dir $atest"
-				rm ${atest}.stdout ${atest}.stderr
-			else
-				echo "FAIL: ${dir}/${atest}"
-			fi
+			rm -rf tests.log
+			./$atest > tests.log 2>&1
+			sed -e '/: pass/ s/^/PASS: /g' \
+			    -e '/: skip/ s/^/SKIP: /g' \
+			    -e '/: fail/ s/^/FAIL: /g' \
+			    -e 's/: pass//g' \
+			    -e 's/: skip//g' \
+			    -e 's/: fail//g' \
+			    -e '/^--- pass:/d' tests.log
 		fi
 	done
 	cd $saved_dir
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/7 jemalloc: fix the race during do_install

In reply to [email protected]

From: Mingli Yu <[email protected]>

Fixes:
| TOPDIR/tmp-glibc/hosttools/install: cannot stat 'doc/jemalloc.3': No such file or directory | make: *** [Makefile:513: install_doc_man] Error 1

---
 ...ke-sure-doc-generated-before-install.patch | 42 +++++++++++++++++++
 .../jemalloc/jemalloc_5.2.1.bb                |  4 +-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/jemalloc/files/0001-Makefile.in-make-sure-doc-generated-before-install.patch
meta-oe/recipes-devtools/jemalloc/files/0001-Makefile.in-make-sure-doc-generated-before-install.patch new file +42 -0
new file mode 100644
index 000000000..0a1fe6d76
@@ -0,0 +1,42 @@
+From 1efb45330f5dbe475a092cda6982e6d7e135485a Mon Sep 17 00:00:00 2001
+From: Mingli Yu <[email protected]>
+Date: Tue, 10 Aug 2021 13:02:18 +0000
+Subject: [PATCH] Makefile.in: make sure doc generated before install
+
+There is a race between the doc generation and the doc installation,
+so make the install depend on the build for doc to fix the error occurs
+sometimes as below:
+ | TOPDIR/tmp-glibc/hosttools/install: cannot stat 'doc/jemalloc.3': No such file or directory
+ | make: *** [Makefile:513: install_doc_man] Error 1
+
+Upstream-Status: Submitted [https://github.com/jemalloc/jemalloc/pull/2108]
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ Makefile.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 7128b007..ab94f0c8 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -501,14 +501,14 @@ install_lib: install_lib_static
+ endif
+ install_lib: install_lib_pc
+ 
+-install_doc_html:
++install_doc_html: build_doc_html
+ 	$(INSTALL) -d $(DATADIR)/doc/jemalloc$(install_suffix)
+ 	@for d in $(DOCS_HTML); do \
+ 	echo "$(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \
+ 	$(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
+ done
+ 
+-install_doc_man:
++install_doc_man: build_doc_man
+ 	$(INSTALL) -d $(MANDIR)/man3
+ 	@for d in $(DOCS_MAN3); do \
+ 	echo "$(INSTALL) -m 644 $$d $(MANDIR)/man3"; \
+-- 
+2.29.2
+
meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb +3 -1
index 39637663f..b191f729a 100644
@@ -13,7 +13,9 @@ SECTION = "libs"
 
 LIC_FILES_CHKSUM = "file://README;md5=6900e4a158982e4c4715bf16aa54fa10"
 
-SRC_URI = "git://github.com/jemalloc/jemalloc.git"
+SRC_URI = "git://github.com/jemalloc/jemalloc.git \
+           file://0001-Makefile.in-make-sure-doc-generated-before-install.patch \
+"
 
 SRCREV = "ea6b3e973b477b8061e0076bb257dbd7f3faa756"
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH 4/7 jemalloc: add ptest support

In reply to [email protected]

From: Mingli Yu <[email protected]>

Add ptest support.

---
 .../recipes-devtools/jemalloc/files/run-ptest | 19 +++++++++++++++++++
 .../jemalloc/jemalloc_5.2.1.bb                | 17 ++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/jemalloc/files/run-ptest
meta-oe/recipes-devtools/jemalloc/files/run-ptest new file +19 -0
new file mode 100644
index 000000000..ea9d80cbb
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+saved_dir=$PWD
+for dir in tests/* ; do
+	cd $dir
+	for atest in * ; do
+		if [ \( -x $atest \) -a \( -f $atest \) ] ; then
+			./$atest > ${atest}.stdout 2> ${atest}.stderr
+			if [ $? = 0 ] ; then
+				echo "PASS: $dir $atest"
+				rm ${atest}.stdout ${atest}.stderr
+			else
+				echo "FAIL: ${dir}/${atest}"
+			fi
+		fi
+	done
+	cd $saved_dir
+done
+
meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb +16 -1
index b191f729a..b5d53bb11 100644
@@ -15,14 +15,29 @@ LIC_FILES_CHKSUM = "file://README;md5=6900e4a158982e4c4715bf16aa54fa10"
 
 SRC_URI = "git://github.com/jemalloc/jemalloc.git \
            file://0001-Makefile.in-make-sure-doc-generated-before-install.patch \
+           file://run-ptest \
 "
 
 SRCREV = "ea6b3e973b477b8061e0076bb257dbd7f3faa756"
 
 S = "${WORKDIR}/git"
 
-inherit autotools
+inherit autotools ptest
 
 EXTRA_AUTORECONF += "--exclude=autoheader"
 
 EXTRA_OECONF:append:libc-musl = " --with-jemalloc-prefix=je_"
+
+do_compile_ptest() {
+	oe_runmake tests
+}
+
+do_install_ptest() {
+	install -d ${D}${PTEST_PATH}/tests
+	subdirs="test/unit test/integration test/stress "
+	for tooltest in ${subdirs}
+	do
+		cp -r ${B}/${tooltest} ${D}${PTEST_PATH}/tests
+	done
+	find ${D}${PTEST_PATH}/tests \( -name "*.d" -o -name "*.o" \) -exec rm -f {} \;
+}
Signature · 1 line
2.17.1
#6 lore raw

PATCH 7/7 jemalloc: set precise BSD license

In reply to [email protected]

From: Armin Kuster <[email protected]>

"BSD" is ambiguous, use the precise licenses BSD-3-Clause

---
 meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-devtools/jemalloc/jemalloc_5.2.1.bb +1 -1
index d4fed864d..7cd06f102 100644
@@ -7,7 +7,7 @@ DESCRIPTION = "jemalloc is a general purpose malloc(3) implementation that empha
 fragmentation avoidance and scalable concurrency support."
 
 HOMEPAGE = "https://github.com/jemalloc/jemalloc"
-LICENSE = "BSD"
+LICENSE = "BSD-2-Clause"
 
 SECTION = "libs"
 
Signature · 1 line
2.17.1
#7 lore raw

Re: [oe] [meta-oe][hardknott][PATCH 7/7] jemalloc: set precise BSD license

Hi,

Quoted 5 lines · Mingli

From: Armin Kuster <[email protected]>

"BSD" is ambiguous, use the precise licenses BSD-3-Clause

...

Review

Quoted 3 lines
(quoted diff) +1 -1
-LICENSE = "BSD"
+LICENSE = "BSD-2-Clause”

I realize this is a backport, but the commit message doesn’t match the change. Should the license be BSD-2-Clause, or BSD-3-Clause?

-a