- Root cause: header-based class indexing (HEADER_CLASSIDX=1) wrote a 1-byte header during allocation, but linear carve/refill and initial slab capacity still used bare class block sizes. This mismatch could overrun slab usable space and corrupt freelists, causing reproducible SEGV at ~100k iters. Changes - Superslab: compute capacity with effective stride (block_size + header for classes 0..6; class7 remains headerless) in superslab_init_slab(). Add a debug-only bound check in superslab_alloc_from_slab() to fail fast if carve would exceed usable bytes. - Refill (non-P0 and P0): use header-aware stride for all linear carving and TLS window bump operations. Ensure alignment/validation in tiny_refill_opt.h also uses stride, not raw class size. - Drain: keep existing defense-in-depth for remote sentinel and sanitize nodes before splicing into freelist (already present). Notes - This unifies the memory layout across alloc/linear-carve/refill with a single stride definition and keeps class7 (1024B) headerless as designed. - Debug builds add fail-fast checks; release builds remain lean. Next - Re-run Tiny benches (256/1024B) in debug to confirm stability, then in release. If any remaining crash persists, bisect with HAKMEM_TINY_P0_BATCH_REFILL=0 to isolate P0 batch carve, and continue reducing branch-miss as planned.
96 lines
2.8 KiB
Bash
Executable File
96 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# dev_pool_tls.sh - Pool TLS Phase 1.5a 開発サイクル統合スクリプト
|
|
#
|
|
# Build → Verify → Quick Test の一連の流れを自動化
|
|
|
|
set -euo pipefail
|
|
|
|
ACTION="${1:-test}"
|
|
TARGET="${2:-bench_mid_large_mt_hakmem}"
|
|
|
|
case "$ACTION" in
|
|
build)
|
|
echo "🔨 Building Pool TLS Phase 1.5a..."
|
|
./build_pool_tls.sh "$TARGET"
|
|
;;
|
|
|
|
verify)
|
|
echo "🔍 Verifying build..."
|
|
./verify_build.sh "$TARGET"
|
|
;;
|
|
|
|
test)
|
|
echo "========================================="
|
|
echo " 🚀 Pool TLS Phase 1.5a Dev Cycle"
|
|
echo "========================================="
|
|
echo ""
|
|
|
|
# 1. Build
|
|
echo "📦 Step 1/3: Building..."
|
|
./build_pool_tls.sh "$TARGET" >/dev/null 2>&1
|
|
echo "✓ Build complete"
|
|
|
|
# 2. Verify
|
|
echo "🔍 Step 2/3: Verifying..."
|
|
if ./verify_build.sh "$TARGET" >/dev/null 2>&1; then
|
|
echo "✓ Build verification passed"
|
|
else
|
|
echo "❌ Build verification FAILED"
|
|
exit 1
|
|
fi
|
|
|
|
# 3. Quick smoke test
|
|
echo "🧪 Step 3/3: Quick smoke test..."
|
|
RESULT=$(timeout 10 ./"$TARGET" 1 100 256 42 2>&1 | grep "Throughput" || echo "FAILED")
|
|
|
|
if [[ "$RESULT" == *"FAILED"* ]]; then
|
|
echo "❌ Smoke test FAILED"
|
|
exit 1
|
|
fi
|
|
|
|
OPS=$(echo "$RESULT" | awk '{print $3}')
|
|
echo "✓ Smoke test passed: $OPS ops/s"
|
|
|
|
echo ""
|
|
echo "========================================="
|
|
echo " ✅ All checks passed!"
|
|
echo "========================================="
|
|
echo ""
|
|
echo "💡 Next steps:"
|
|
echo " # Full benchmark"
|
|
echo " ./run_pool_bench.sh"
|
|
echo ""
|
|
echo " # Debug if needed"
|
|
echo " ./build_debug.sh $TARGET gdb"
|
|
echo " gdb ./$TARGET"
|
|
;;
|
|
|
|
bench)
|
|
echo "📊 Running full benchmark..."
|
|
./run_pool_bench.sh
|
|
;;
|
|
|
|
clean)
|
|
echo "🧹 Cleaning build artifacts..."
|
|
make clean >/dev/null 2>&1 || true
|
|
echo "✓ Clean complete"
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: $0 {build|verify|test|bench|clean} [target]"
|
|
echo ""
|
|
echo "Actions:"
|
|
echo " build - Build Pool TLS Phase 1.5a"
|
|
echo " verify - Verify build integrity"
|
|
echo " test - Build + Verify + Quick smoke test (default)"
|
|
echo " bench - Run full benchmark vs System malloc"
|
|
echo " clean - Clean build artifacts"
|
|
echo ""
|
|
echo "Examples:"
|
|
echo " $0 test # Quick dev cycle"
|
|
echo " $0 bench # Full benchmark"
|
|
echo " $0 build larson_hakmem # Build Larson test"
|
|
exit 1
|
|
;;
|
|
esac
|