Boxify superslab registry, add bench profile, and document C7 hotpath experiments

This commit is contained in:
Moe Charm (CI)
2025-12-07 03:12:27 +09:00
parent 18faa6a1c4
commit fda6cd2e67
71 changed files with 2052 additions and 286 deletions

View File

@ -15,23 +15,37 @@
#include <stdatomic.h>
#include <stdint.h>
#include <stdlib.h>
#include "../hakmem_tiny_config.h"
typedef struct TinyClassPolicy {
uint8_t page_box_enabled; // Enable Tiny Page Box for this class
uint8_t warm_enabled; // Enable Warm Pool for this class
uint8_t warm_cap; // Max warm SuperSlabs to keep (per-thread)
uint8_t reserved;
uint8_t tls_carve_enabled; // Enable Warm→TLS carve experiment for this class
} TinyClassPolicy;
extern TinyClassPolicy g_tiny_class_policy[TINY_NUM_CLASSES];
// ENV-gated policy logging (default ON; disable with HAKMEM_TINY_POLICY_LOG=0)
static inline int tiny_policy_log_enabled(void) {
static int g_policy_log = -1;
if (__builtin_expect(g_policy_log == -1, 0)) {
const char* e = getenv("HAKMEM_TINY_POLICY_LOG");
g_policy_log = (e && *e && *e != '0') ? 1 : 0;
}
return g_policy_log;
}
// Initialize policy table once (idempotent).
void tiny_class_policy_init_once(void);
// Refresh auto profile based on learner output (no-op for non-auto profiles)
void tiny_class_policy_refresh_auto(void);
// True when active profile is "auto" (learner-managed)
int tiny_class_policy_is_auto(void);
// Debug helper: dump current policy (tag optional)
void tiny_class_policy_dump(const char* tag);