Guard madvise ENOMEM and stabilize pool/tiny front v3

This commit is contained in:
Moe Charm (CI)
2025-12-09 21:50:15 +09:00
parent e274d5f6a9
commit a905e0ffdd
45 changed files with 3154 additions and 242 deletions

View File

@ -36,7 +36,8 @@ typedef struct tiny_hotheap_class_v2 {
tiny_hotheap_page_v2* partial_pages;
tiny_hotheap_page_v2* full_pages;
uint16_t stride;
uint16_t _pad;
uint16_t max_partial_pages; // 空ページを保持する上限C7 専用で 1〜2 を想定)
uint16_t partial_count; // いま握っている partial の枚数
tiny_hotheap_page_v2 storage_page; // C7 専用の 1 枚だけをまず保持Phase36: reuse when空き
} tiny_hotheap_class_v2;
@ -51,8 +52,8 @@ extern __thread tiny_hotheap_ctx_v2* g_tiny_hotheap_ctx_v2;
tiny_hotheap_ctx_v2* tiny_hotheap_v2_tls_get(void);
void* tiny_hotheap_v2_alloc(uint8_t class_idx);
void tiny_hotheap_v2_free(uint8_t class_idx, void* p, void* meta);
void tiny_hotheap_v2_record_route_fallback(void);
void tiny_hotheap_v2_record_free_fallback(void);
void tiny_hotheap_v2_record_route_fallback(uint8_t class_idx);
void tiny_hotheap_v2_record_free_fallback(uint8_t class_idx);
typedef struct tiny_hotheap_v2_stats_snapshot {
uint64_t route_hits;
@ -65,11 +66,19 @@ typedef struct tiny_hotheap_v2_stats_snapshot {
uint64_t free_calls;
uint64_t free_fast;
uint64_t free_fallback_v1;
uint64_t cold_refill_fail;
uint64_t cold_retire_calls;
uint64_t retire_calls_v2;
uint64_t prepare_calls;
uint64_t prepare_with_current_null;
uint64_t prepare_from_partial;
uint64_t free_made_current;
uint64_t page_retired;
uint64_t partial_pushes;
uint64_t partial_pops;
uint64_t partial_peak;
uint64_t refill_with_current;
uint64_t refill_with_partial;
} tiny_hotheap_v2_stats_snapshot_t;
void tiny_hotheap_v2_debug_snapshot(tiny_hotheap_v2_stats_snapshot_t* out);