Files
hakmem/docs/status/archive/P2_TINY_TLS_2025_10_23.md
Moe Charm (CI) 52386401b3 Debug Counters Implementation - Clean History
Major Features:
- Debug counter infrastructure for Refill Stage tracking
- Free Pipeline counters (ss_local, ss_remote, tls_sll)
- Diagnostic counters for early return analysis
- Unified larson.sh benchmark runner with profiles
- Phase 6-3 regression analysis documentation

Bug Fixes:
- Fix SuperSlab disabled by default (HAKMEM_TINY_USE_SUPERSLAB)
- Fix profile variable naming consistency
- Add .gitignore patterns for large files

Performance:
- Phase 6-3: 4.79 M ops/s (has OOM risk)
- With SuperSlab: 3.13 M ops/s (+19% improvement)

This is a clean repository without large log files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 12:31:14 +09:00

1.6 KiB
Raw Blame History

Phase P2: Tiny の完全TLS化とリモートフリー改良

目的: Tiny(≤1KiB)の4Tスケールを改善し、ロック競合とリモートフリーの負債を削減。

実装

  • 完全TLSアリーナクラス別Active Slab

    • __thread TinySlab* g_tls_active_slab[TINY_NUM_CLASSES]
    • alloc時は Magazine→ActiveSlab(所有スレ)→共有FreeList の順で探索
    • ActiveSlab採用ロジックを強化共有リスト先頭をTLSに引き抜き、以降はロックレス運用
  • MPSCリモートフリーの閾値ドレイン

    • TinySlabに atomic_uint remote_count を追加し、push/drainで増減
    • しきい値以上でオーナー側/クラスロック下でドレインを実施
    • ランダム確率でドレイン試行(過剰ドレイン防止)
  • ラッパー時の安全リフィル(既存)

    • HAKMEM_WRAP_TINY=1 時は magazine-first + ActiveSlab ロックレス
    • HAKMEM_WRAP_TINY_REFILL=1 で小規模trylockリフィルを許可

環境変数

  • HAKMEM_TINY_REMOTE_DRAIN_THRESHOLD(既定 32
  • HAKMEM_TINY_REMOTE_DRAIN_TRYRATE(既定 16 → 1/16確率で試行
  • HAKMEM_TINY_MAG_CAPTLS magazine上限、既定2048/クラスによる)
  • HAKMEM_WRAP_TINY / HAKMEM_WRAP_TINY_REFILL既定OFF

初期結果1秒, 簡易)

  • Tiny(864B)
    • 1T: ~18.620.1M ops/s
    • 4T: ~40.143.4M ops/s+数% 改善)

次ステップ

  • 2秒→10秒に段階拡大して、ActiveSlabとドレインしきい値のA/B4T中心
  • WRAP_TINY(=1)の効果は条件依存のため既定OFFを維持A/Bで限定的に使用