ENV cleanup: Remove BG/HotMag vars & guard fprintf (Larson 52.3M ops/s)
Phase 1 完了:環境変数整理 + fprintf デバッグガード ENV変数削除(BG/HotMag系): - core/hakmem_tiny_init.inc: HotMag ENV 削除 (~131 lines) - core/hakmem_tiny_bg_spill.c: BG spill ENV 削除 - core/tiny_refill.h: BG remote 固定値化 - core/hakmem_tiny_slow.inc: BG refs 削除 fprintf Debug Guards (#if !HAKMEM_BUILD_RELEASE): - core/hakmem_shared_pool.c: Lock stats (~18 fprintf) - core/page_arena.c: Init/Shutdown/Stats (~27 fprintf) - core/hakmem.c: SIGSEGV init message ドキュメント整理: - 328 markdown files 削除(旧レポート・重複docs) 性能確認: - Larson: 52.35M ops/s (前回52.8M、安定動作✅) - ENV整理による機能影響なし - Debug出力は一部残存(次phase で対応) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -28,32 +28,13 @@ extern unsigned long long g_rf_early_no_room[];
|
||||
extern unsigned long long g_rf_early_want_zero[];
|
||||
#endif
|
||||
|
||||
// Optional P0 diagnostic logging helper
|
||||
static inline int p0_should_log(void) {
|
||||
static int en = -1;
|
||||
if (__builtin_expect(en == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_TINY_P0_LOG");
|
||||
en = (e && *e && *e != '0') ? 1 : 0;
|
||||
}
|
||||
return en;
|
||||
}
|
||||
// P0 diagnostic logging is now permanently disabled (former ENV toggle removed).
|
||||
static inline int p0_should_log(void) { return 0; }
|
||||
|
||||
// P0 batch refill entry point
|
||||
static inline int sll_refill_batch_from_ss(int class_idx, int max_take) {
|
||||
// Phase E1-CORRECT: C7 now has headers, can use P0 batch refill
|
||||
|
||||
// Runtime A/B kill switch (defensive). Set HAKMEM_TINY_P0_DISABLE=1 to bypass P0 path.
|
||||
do {
|
||||
static int g_p0_disable = -1;
|
||||
if (__builtin_expect(g_p0_disable == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_TINY_P0_DISABLE");
|
||||
g_p0_disable = (e && *e && *e != '0') ? 1 : 0;
|
||||
}
|
||||
if (__builtin_expect(g_p0_disable, 0)) {
|
||||
return 0;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
HAK_CHECK_CLASS_IDX(class_idx, "sll_refill_batch_from_ss");
|
||||
if (__builtin_expect(class_idx < 0 || class_idx >= TINY_NUM_CLASSES, 0)) {
|
||||
static _Atomic int g_p0_class_oob_log = 0;
|
||||
@ -109,26 +90,14 @@ static inline int sll_refill_batch_from_ss(int class_idx, int max_take) {
|
||||
#endif
|
||||
|
||||
// Optional: Direct-FC fast path(全クラス対応 A/B)。
|
||||
// Env:
|
||||
// - HAKMEM_TINY_P0_DIRECT_FC=1 → C5優先(互換)
|
||||
// - HAKMEM_TINY_P0_DIRECT_FC_C7=1 → C7のみ(互換)
|
||||
// - HAKMEM_TINY_P0_DIRECT_FC_ALL=1 → 全クラス(推奨、Phase 1 目標)
|
||||
// Fixed defaults after ENV cleanup:
|
||||
// - C5優先: enabled
|
||||
// - C7のみ: disabled
|
||||
// - 全クラス: disabled
|
||||
do {
|
||||
static int g_direct_fc = -1;
|
||||
static int g_direct_fc_c7 = -1;
|
||||
static int g_direct_fc_all = -1;
|
||||
if (__builtin_expect(g_direct_fc == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_TINY_P0_DIRECT_FC");
|
||||
g_direct_fc = (e && *e && *e == '0') ? 0 : 1;
|
||||
}
|
||||
if (__builtin_expect(g_direct_fc_c7 == -1, 0)) {
|
||||
const char* e7 = getenv("HAKMEM_TINY_P0_DIRECT_FC_C7");
|
||||
g_direct_fc_c7 = (e7 && *e7) ? ((*e7 == '0') ? 0 : 1) : 0;
|
||||
}
|
||||
if (__builtin_expect(g_direct_fc_all == -1, 0)) {
|
||||
const char* ea = getenv("HAKMEM_TINY_P0_DIRECT_FC_ALL");
|
||||
g_direct_fc_all = (ea && *ea && *ea != '0') ? 1 : 0;
|
||||
}
|
||||
const int g_direct_fc = 1;
|
||||
const int g_direct_fc_c7 = 0;
|
||||
const int g_direct_fc_all = 0;
|
||||
if (__builtin_expect(g_direct_fc_all ||
|
||||
(g_direct_fc && class_idx == 5) ||
|
||||
(g_direct_fc_c7 && class_idx == 7), 0)) {
|
||||
@ -137,22 +106,10 @@ static inline int sll_refill_batch_from_ss(int class_idx, int max_take) {
|
||||
|
||||
uint32_t rmt = atomic_load_explicit(
|
||||
&tls->ss->remote_counts[tls->slab_idx], memory_order_relaxed);
|
||||
static int g_drain_th = -1;
|
||||
if (__builtin_expect(g_drain_th == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_TINY_P0_DRAIN_THRESH");
|
||||
int v = (e && *e) ? atoi(e) : 64;
|
||||
g_drain_th = (v < 0) ? 0 : v;
|
||||
}
|
||||
const int g_drain_th = 64;
|
||||
if (rmt >= (uint32_t)g_drain_th) {
|
||||
static int no_drain = -1;
|
||||
if (__builtin_expect(no_drain == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_TINY_P0_NO_DRAIN");
|
||||
no_drain = (e && *e && *e != '0') ? 1 : 0;
|
||||
}
|
||||
if (!no_drain) {
|
||||
_ss_remote_drain_to_freelist_unsafe(
|
||||
tls->ss, tls->slab_idx, tls->meta);
|
||||
}
|
||||
_ss_remote_drain_to_freelist_unsafe(
|
||||
tls->ss, tls->slab_idx, tls->meta);
|
||||
}
|
||||
|
||||
void* out[128];
|
||||
@ -226,14 +183,7 @@ static inline int sll_refill_batch_from_ss(int class_idx, int max_take) {
|
||||
uint32_t remote_count = atomic_load_explicit(
|
||||
&tls->ss->remote_counts[tls->slab_idx], memory_order_relaxed);
|
||||
if (remote_count > 0) {
|
||||
static int no_drain = -1;
|
||||
if (__builtin_expect(no_drain == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_TINY_P0_NO_DRAIN");
|
||||
no_drain = (e && *e && *e != '0') ? 1 : 0;
|
||||
}
|
||||
if (!no_drain) {
|
||||
_ss_remote_drain_to_freelist_unsafe(tls->ss, tls->slab_idx, meta);
|
||||
}
|
||||
_ss_remote_drain_to_freelist_unsafe(tls->ss, tls->slab_idx, meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user