Files
hakmem/docs/status/CURRENT_TASK.md
Moe Charm (CI) 0f071bf2e5 Update CURRENT_TASK with 2025-11-29 critical bug fixes
Summary of completed work:
1. Header Corruption Bug - Root cause fixed in 2 freelist paths
   - box_carve_and_push_with_freelist()
   - tiny_drain_freelist_to_sll_once()
   - Result: 20-thread Larson 0 errors ✓

2. Segmentation Fault Bug - Missing function declaration fixed
   - superslab_allocate() implicit int → pointer corruption
   - Fixed in 2 files with proper includes
   - Result: larson_hakmem stable ✓

Both bugs fully resolved via Task agent investigation
+ Claude Code ultrathink analysis.

Updated files:
- docs/status/CURRENT_TASK_FULL.md (detailed analysis)
- docs/status/CURRENT_TASK.md (executive summary)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 06:29:02 +09:00

6.7 KiB
Raw Blame History

CURRENT TASK - Critical Bugs Fixed

Last Updated: 2025-11-29 Branch: master @ 6d40dc741 Scope: Header Corruption + Segfault 根治完了 - 完全安定化達成


🎉 2025-11-29 UPDATE: CRITICAL BUGS RESOLVED

完了した修正

1. Header Corruption Bug (Class 1) - 根治完了

  • 症状: [TLS_SLL_HDR_RESET] cls=1 got=0x00 expect=0xa1
  • 原因: freelist → TLS SLL の2パスで header 未復元
  • 修正: 両パスに header restoration 追加
  • 結果: 20-thread Larson で header corruption 完全消滅

Commits:

  • 3c6c76cb1 - box_carve_and_push_with_freelist() fix
  • a94344c1a - tiny_drain_freelist_to_sll_once() fix

2. Segmentation Fault Bug - 根治完了

  • 症状: larson_hakmem が intermittent に SEGV (~50% 確率)
  • 原因: superslab_allocate() の implicit int declaration → pointer corruption via sign extension
  • 修正: 2ファイルに #include "box/ss_allocation_box.h" 追加
  • 結果: larson_hakmem が完全安定動作

Commit:

  • 6d40dc741 - Add missing superslab_allocate() declaration

🔬 Task Agent の貢献

  • Header corruption: 全 freelist paths を網羅的調査、dead code path まで発見
  • Segfault: gdb + coredump で Assembly レベル解析、sign extension メカニズムを特定

📊 現在の安定性

Test Status
Larson 1T 安定動作 (51.95M ops/s)
Larson 4T 安定動作 (header validation 有効)
Larson 20T Header corruption 0 errors
Random Mixed 安定動作 (66.82M ops/s)
SuperSlab expansion Segfault 消滅

📋 Stable Master Established (2025-11-26)

Branch: master (formerly larson-master-rebuild) Scope: 安定版 master 確立完了 - Larson 動作 + 67M ops/s


🎯 現状サマリ

新 master 性能(安定版)

Benchmark Performance Status
Larson 1T 51.95M ops/s 安定動作 (0% crash)
Random Mixed 256B 66.82M ops/s 安定動作

Branch: master @ d26dd092b Architecture: E1-CORRECT (C0,C7 offset=0; C1-C6 offset=1)

📚 旧 master 保存(参考用)

  • Branch: master-80M-unstable @ 328a6b722
  • Random Mixed: ~80M ops/s
  • Larson: 100% クラッシュ (Step 2.5 バグ)
  • Architecture: UNIFIED-HEADER (全クラス offset=1)
  • 80M 達成経路: PERFORMANCE_HISTORY_62M_TO_80M.md 参照

📋 作業計画

Phase 0: 安定ベースライン確立 DONE

  • larson-fix ブランチから larson-master-rebuild 作成
  • Larson 動作確認 (51M ops/s)
  • Random Mixed 動作確認 (62M ops/s)

Phase 1: クリーンアップ & 安定化 DONE

目標: 安定状態でコードベースを整理

1.1 Cherry-pick 済み7コミット

  • 9793f17d6 レガシーコード削除 (-1,159 LOC)
  • cc0104c4e テストファイル削除 (-1,750 LOC)
  • 416930eb6 バックアップファイル削除 (-1,072 KB)
  • 225b6fcc7 死コード削除: UltraHot, RingCache等 (-1,844 LOC)
  • 2c99afa49 学習システムバグドキュメント
  • 328a6b722 Larsonバグ分析更新
  • 0143e0fed CONFIGURATION.md 追加

1.2 追加最適化

  • a2e65716b tiny_get_max_size inline化 (+2M ops/s期待値)
  • d35504163 Superslab Min-Keep ポート(後にリバート)
  • bea839add Min-Keep リバートLarson 安定化)
  • d26dd092b Performance History ドキュメント作成

1.3 master 確立

  • 旧 master を master-80M-unstable にバックアップ
  • master ブランチを安定版 (d26dd092b) に更新
  • Larson 0% crash 確認 (51.95M ops/s)
  • Random Mixed 67M ops/s 確認

Phase 2: 性能最適化ポート 📊 PENDING

目標: 62M → 80M+ ops/s 回復

2.1 簡単なチューニング(独立・低リスク)

  • e81fe783d tiny_get_max_size inline化 (+2M)
  • 04a60c316 Superslab/SharedPool チューニング (+1M)
  • 392d29018 Unified Cache容量チューニング (+1M)
  • dcd89ee88 Stage 1 lock-free (+0.3M)

2.2 本丸UNIFIED-HEADER

  • 472b6a60b Phase UNIFIED-HEADER (+17%, C7ヘッダ統一)
  • d26519f67 UNIFIED-HEADERバグ修正 (+15-41%)
  • 165c33bc2 Larsonフォールバック修正必要なら

2.3 スキップ対象

  • 03d321f6b Phase 27 Ultra-Inline → -10~15%回帰
  • Step 2.5関連コミット → Larsonクラッシュの原因

Phase 3: 検証 & マージ 🔀 PENDING

  • Larson 10回平均ベンチマーク
  • Random Mixed 10回平均ベンチマーク
  • master ブランチ更新

🔍 根本原因分析

Larson クラッシュの原因

First Bad Commit: 19c1abfe7 "Fix Unified Cache TLS SLL bypass"

Step 2.5 が TLS_SLL_PUSH_DUP を「修正」するために追加されたが:

  1. TLS_SLL_PUSH_DUP は実際には発生しないベースで10M回テスト済み
  2. Step 2.5 がマルチスレッド環境で cross-thread ownership 問題を引き起こす
  3. 結論:不要な「修正」が Larson を壊した

80M 達成の主要因

コミット 内容 改善幅
472b6a60b UNIFIED-HEADER (C7統一) +17%
d26519f67 UH バグ修正 +15-41%
その他チューニング inline, policy等 +4-5M

📁 関連ファイル

修正対象

  • core/front/tiny_unified_cache.c - Step 2.5 なしのまま維持
  • core/tiny_free_fast_v2.inc.h - LARSON_FIX 関連
  • core/box/ptr_conversion_box.h - UNIFIED-HEADER で変更予定

ドキュメント

  • LEARNING_SYSTEM_BUGS_P0.md - 学習システムバグ記録
  • CONFIGURATION.md - ENV変数リファレンス
  • PROFILES.md - 性能プロファイル

完了マイルストーン

  1. Larson 安定化 - 51M ops/s で動作
  2. Cherry-pick Phase 1 - 7コミット完了
  3. ベースライン確立 - 62M/51M で安定

🎯 次のアクション

現時点での選択肢

  1. Option A: 現状維持(推奨)

    • master @ 67M ops/s (Larson 安定)
    • 80M の知見は PERFORMANCE_HISTORY_62M_TO_80M.mdmaster-80M-unstable に保存済み
    • Phase 2 (性能最適化) は将来の作業として保留
  2. Option B: UNIFIED-HEADER ポート(高難度)

    • 80M 達成の主要因(+17% + +15-41%
    • E1-CORRECT との互換性問題あり
    • 大規模な書き換えが必要
    • 詳細: PERFORMANCE_HISTORY_62M_TO_80M.md Section "Option 3"
  3. Option C: Step 2.5 Revert失敗済み

    • master-80M-unstable から Step 2.5 をリバート
    • 複雑な conflict (33行変更) で35+ 回失敗済み
    • 推奨しない