Phase v4-mid-2, v4-mid-3, v4-mid-5: SmallObject HotBox v4 implementation and docs update

Implementation:
- SmallObject HotBox v4 (core/smallobject_hotbox_v4.c) now fully implements C6-only allocations and frees, including current/partial management and freelist operations.
- Cold Iface (tiny_heap based) for page refill/retire is integrated.
- Stats instrumentation (v4-mid-5) added to small_heap_alloc_fast_v4 and small_heap_free_fast_v4, with a new header file core/box/smallobject_hotbox_v4_stats_box.h and atexit dump function.

Updates:
- CURRENT_TASK.md has been condensed and updated with summaries of Phase v4-mid-2 (C6-only v4), Phase v4-mid-3 (C5-only v4 pilot), and the stats implementation (v4-mid-5).
- docs/analysis/SMALLOBJECT_V4_BOX_DESIGN.md updated with A/B results and conclusions for C6-only and C5-only v4 implementations.
- The previous CURRENT_TASK.md content has been archived to CURRENT_TASK_ARCHIVE_20251210.md.
This commit is contained in:
Moe Charm (CI)
2025-12-11 01:01:15 +09:00
parent 3b4449d773
commit dd974b49c5
5 changed files with 1569 additions and 1182 deletions

View File

@ -141,3 +141,70 @@ static inline SmallPageMeta* small_page_meta_of(void* p) {
- block_size[class]
- max_partial_pages[class]
を更新するだけ。HotBox_v4 側は snapshot を読むだけに留める。
---
## Phase v4-mid-2: C6-only SmallHeapCtx v4 本実装完了 (2025-12-10)
### 実装内容
- `core/smallobject_hotbox_v4.c` に C6 用 SmallHeapCtx v4 を本格稼働:
- `small_heap_alloc_fast_v4()`: current freelist → partial head → cold_refill の順で探索。
- `small_heap_free_fast_v4()`: v4_find_page で page を特定 → freelist push → used==0 なら partial に温存 or retire。
- Cold Iface (`small_cold_v4_refill_page` / `small_cold_v4_retire_page`) は tiny_heap 経由で動作済み。
- Segment 関連 (`smallsegment_v4_*`) は tiny_heap を利用して page lease/retire を実装。
### A/B 結果C6-heavy 257768B, 1 thread, ws=400, iters=1M
| 構成 | Throughput (ops/s) | 備考 |
|------|-------------------|------|
| v4 OFF (baseline) | 9.13M 9.79M | 平均 ~9.36M |
| v4 ON (C6-only) | 10.00M 10.30M | 平均 ~10.15M |
| **改善** | **+8〜9%** | segv/assert なし |
### Mixed への影響161024B, ws=400, iters=1M
| 構成 | Throughput (ops/s) |
|------|-------------------|
| v4 OFF | 29.66M |
| v4 ON (C6-only) | 29.96M (+1%) |
→ 大きな回帰なし、研究箱として安全。
### ENV 設定例
```bash
HAKMEM_PROFILE=C6_HEAVY_LEGACY_POOLV1 \
HAKMEM_SMALL_HEAP_V4_ENABLED=1 \
HAKMEM_SMALL_HEAP_V4_CLASSES=0x40 \
./bench_mid_large_mt_hakmem 1 1000000 400 1
```
### 次ステップ
- Phase v4-mid-3: C5 v4 パイロット、または Mixed の一部クラスを SMALL_V4 route に昇格させて A/B。
---
## Phase v4-mid-3: C5-only v4 研究箱 A/B (2025-12-11)
### 実装内容
- C5 (256B class) は既に `v4_class_supported()` で許可済み。コード変更は不要。
- ENV `HAKMEM_SMALL_HEAP_V4_CLASSES=0x20` で C5 v4 を有効化。
### A/B 結果
**C5-heavy (129256B, ws=400, iters=1M)**
| 構成 | Throughput (ops/s) | 備考 |
|------|-------------------|------|
| v4 OFF | 53.6M 55.4M | 平均 ~54.4M |
| v4 ON (C5-only 0x20) | 47.6M 49.5M | 平均 ~48.7M |
| **結果** | **10〜11% 回帰** | 既存 Tiny/front v3 経路が速い |
**Mixed 161024B (C5+C6 v4)**
| 構成 | Throughput (ops/s) |
|------|-------------------|
| C6-only v4 (0x40) | 27.5M 29.3M (平均 ~28.3M) |
| C5+C6 v4 (0x60) | 28.3M 29.4M (平均 ~28.9M) |
| **結果** | **+2〜3% (誤差〜微改善)** |
### 方針
- C5-heavy では v4 が既存経路より劣後するため、C5 v4 は**研究箱のまま**標準プロファイルには入れない。
- Mixed では影響が小さく回帰なし。C5+C6 v4 (0x60) は研究箱として安全に利用可能。
- C5 サイズ帯は既存 Tiny/front v3 経路が十分最適化されており、v4 へ寄せるメリットは薄い。
- 今後の small-object v4 拡張は C6-heavy / mid 帯に集中する。