From 6f48074221e3e757df86b2afe9a254b907e969b9 Mon Sep 17 00:00:00 2001 From: northriv Date: Thu, 11 Jun 2026 21:01:33 +0900 Subject: [PATCH 1/2] Add kamepoolalloc (kp) allocator kamepoolalloc is a lock-free four-tier pool allocator (1 B .. multi-GiB: buckets / dedicated chunks / large mmap / huge) with a per-thread two-level recycle cache for the 32 KiB .. 32 MiB range. Dual-licensed Apache-2.0 OR GPL-2.0+. Production allocator of the KAME instrument-control framework since 2008; the chunk-claim / recycle / orphan-chain protocols are TLA+ and GenMC (RC11) model-checked. https://github.com/northriv/kamepoolalloc Pinned to v1.0.1 (banner gating + Linux malloc_usable_size co-interpose). Full local-suite soak passed on glibc/x86-64 (incl. redis, sh6/sh8bench). --- bench.sh | 3 ++- build-bench-env.sh | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bench.sh b/bench.sh index b169a5b..d563def 100755 --- a/bench.sh +++ b/bench.sh @@ -6,7 +6,7 @@ # Allocators and tests # -------------------------------------------------------------------- -readonly alloc_all="sys dh ff fg gd hd hm hml iso je lf lp lt mi mi-sec mi2 mi2-sec mi3 mi3-sec mng mesh nomesh pa rp sc scudo sg sm sn sn-sec tbb tc tcg mi-dbg mi2-dbg mi3-dbg xmi xsmi xmi-dbg yal rmalloc" +readonly alloc_all="sys kp dh ff fg gd hd hm hml iso je lf lp lt mi mi-sec mi2 mi2-sec mi3 mi3-sec mng mesh nomesh pa rp sc scudo sg sm sn sn-sec tbb tc tcg mi-dbg mi2-dbg mi3-dbg xmi xsmi xmi-dbg yal rmalloc" readonly alloc_secure="dh ff gd hm hml iso mi-sec mi2-sec mi3-sec mng pa scudo sg sn-sec sg" alloc_run="" # allocators to run (expanded by command line options) alloc_installed="sys" # later expanded to include all installed allocators @@ -114,6 +114,7 @@ alloc_lib_add "mesh" "$localdevdir/mesh/build/lib/libmesh$extso" alloc_lib_add "mng" "$localdevdir/mng/libmallocng$extso" alloc_lib_add "nomesh" "$localdevdir/nomesh/build/lib/libmesh$extso" alloc_lib_add "pa" "$localdevdir/pa/partition_alloc_builder/out/Default/libpalib$extso" +alloc_lib_add "kp" "$localdevdir/kp/out/libkamepoolalloc$extso" alloc_lib_add "rp" "$lib_rp" alloc_lib_add "sc" "$localdevdir/sc/out/Release/lib.target/libscalloc$extso" alloc_lib_add "scudo" "$localdevdir/scudo/compiler-rt/lib/scudo/standalone/libscudo$extso" diff --git a/build-bench-env.sh b/build-bench-env.sh index d44d58a..02a6777 100755 --- a/build-bench-env.sh +++ b/build-bench-env.sh @@ -47,6 +47,7 @@ readonly version_iso=1.2.5 readonly version_je=5.3.1 readonly version_lf=master # ~unmaintained since 2018 readonly version_lp=main +readonly version_kp=v1.0.1 readonly version_lt=master # ~unmaintained since 2019 readonly version_mesh=master # ~unmaintained since 2021 readonly version_mi=v1.8.2 @@ -97,6 +98,7 @@ setup_mi3=0 setup_mng=0 setup_nomesh=0 setup_pa=0 +setup_kp=0 setup_rp=0 setup_sc=0 setup_scudo=0 @@ -135,6 +137,7 @@ while : ; do "") break;; all|none) all=$flag_arg + setup_kp=$flag_arg setup_dh=$flag_arg setup_ff=$flag_arg setup_fg=$flag_arg @@ -230,6 +233,8 @@ while : ; do setup_rocksdb=$flag_arg;; linux) setup_linux=$flag_arg;; + kp) + setup_kp=$flag_arg;; rp) setup_rp=$flag_arg;; sc) @@ -281,6 +286,7 @@ while : ; do echo " mng setup mallocng ($version_mng)" echo " nomesh setup mesh allocator w/o meshing ($version_mesh)" echo " pa setup PartitionAlloc ($version_pa)" + echo " kp setup kamepoolalloc ($version_kp)" echo " rp setup rpmalloc ($version_rp)" echo " sc setup scalloc ($version_sc)" echo " scudo setup scudo ($version_scudo)" @@ -654,6 +660,13 @@ if test "$setup_je" = "1"; then popd fi +if test "$setup_kp" = "1"; then + checkout kp $version_kp https://github.com/northriv/kamepoolalloc + cmake -B out -DCMAKE_BUILD_TYPE=Release + cmake --build out --parallel $procs + popd +fi + if test "$setup_rp" = "1"; then checkout rp $version_rp https://github.com/mjansson/rpmalloc if test -f build.ninja; then From 182d87f5f4b0bfef514f05caffd2c74128879e98 Mon Sep 17 00:00:00 2001 From: northriv Date: Thu, 11 Jun 2026 23:05:39 +0900 Subject: [PATCH 2/2] ci: add kp to the platform.yml allocator matrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So CI exercises kamepoolalloc on ubuntu/alpine/fedora (the bench.sh alloc_all registration alone is not enough — the GitHub Actions matrix is the hardcoded driver). glibc (ubuntu/fedora) is the soaked target; musl (alpine) is unverified — if it fails there, a follow-up alpine exclude with the actual error will mirror the existing per-allocator excludes (dh/fg/gd/...). --- .github/workflows/platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/platform.yml b/.github/workflows/platform.yml index c51a50a..fc6ddc6 100644 --- a/.github/workflows/platform.yml +++ b/.github/workflows/platform.yml @@ -37,7 +37,7 @@ jobs: needs: build-base-with-docker strategy: matrix: - allocator: [ff, fg, gd, hd, hm, iso, je, lf, lp, lt, mesh, mng, mi, mi2, mi3, nomesh, pa, rp, scudo, sm, sn, sg, tbb, tc, yal, tcg] + allocator: [ff, fg, gd, hd, hm, iso, je, kp, lf, lp, lt, mesh, mng, mi, mi2, mi3, nomesh, pa, rp, scudo, sm, sn, sg, tbb, tc, yal, tcg] testsuite: [allt] # Used to provide a platform-specific predicate predicate: [true, false]