Priority-2: ENV Cache - SuperSlab層の getenv() を完全置換

変更内容:
- tiny_superslab_alloc.inc.h: 1箇所の getenv() を置換
  (TINY_ALLOC_REMOTE_RELAX)
- tiny_superslab_free.inc.h: 7箇所の getenv() を置換
  (TINY_SLL_DIAG, TINY_ROUTE_FREE x2, TINY_FREE_TO_SS,
   SS_FREE_DEBUG x3, TINY_FREELIST_MASK)

効果: SuperSlab層からも syscall 完全排除

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-12-02 20:22:42 +09:00
parent 802b6e775f
commit 8336febdcb
2 changed files with 32 additions and 59 deletions

View File

@ -10,6 +10,7 @@
#include "hakmem_tiny_superslab_constants.h"
#include "tiny_box_geometry.h" // Box 3: Geometry & Capacity Calculator"
#include "tiny_debug_api.h" // Guard/failfast declarations
#include "hakmem_env_cache.h" // Priority-2: ENV cache (eliminate syscalls)
// ============================================================================
// Phase 6.24: Allocate from SuperSlab slab (lazy freelist + linear allocation)
@ -298,15 +299,11 @@ static inline void* hak_tiny_alloc_superslab(int class_idx) {
}
// Drain remote if needed (ownership-checked elsewhere)
// Priority-2: Use cached ENV (eliminate lazy-init syscall overhead)
if (meta) {
static int g_alloc_remote_relax = -1;
if (__builtin_expect(g_alloc_remote_relax == -1, 0)) {
const char* e = getenv("HAKMEM_TINY_ALLOC_REMOTE_RELAX");
g_alloc_remote_relax = (e && *e && *e != '0') ? 1 : 0;
}
uintptr_t pending = atomic_load_explicit(
&tls->ss->remote_heads[slab_idx],
g_alloc_remote_relax ? memory_order_relaxed : memory_order_acquire);
HAK_ENV_TINY_ALLOC_REMOTE_RELAX() ? memory_order_relaxed : memory_order_acquire);
if (__builtin_expect(pending != 0, 0)) {
uint32_t self_tid = tiny_self_u32();
if (ss_owner_try_acquire(meta, self_tid)) {