/** * hakmem_tiny_config.c * * Implementation of centralized Tiny configuration constants */ #include "hakmem_tiny_config.h" // ============================================================================ // Fast Cache Configuration // ============================================================================ // Factory defaults (“balanced”) – mutable at runtime static const uint16_t k_fast_cap_defaults_factory[TINY_NUM_CLASSES] = { 128, // Class 0: 8B 128, // Class 1: 16B 128, // Class 2: 32B 128, // Class 3: 64B (reduced from 512 to limit RSS) 128, // Class 4: 128B (trimmed via ACE/TLS caps) 128, // Class 5: 256B 128, // Class 6: 512B 64 // Class 7: 1KB (enable small fast cache to reduce Superslab path) }; uint16_t g_fast_cap_defaults[TINY_NUM_CLASSES] = { 128, 128, 128, 128, 128, 128, 128, 64 }; void tiny_config_reset_defaults(void) { for (int i = 0; i < TINY_NUM_CLASSES; i++) { g_fast_cap_defaults[i] = k_fast_cap_defaults_factory[i]; } } // ============================================================================ // TLS Magazine Configuration // ============================================================================ // Default TLS magazine capacities per class int tiny_default_cap(int class_idx) { switch (class_idx) { case 0: return 128; // 8B case 1: return 128; // 16B case 2: return 128; // 32B case 3: return 128; // 64B (reduced from 512 to limit RSS) case 4: return 96; // 128B (aggressively trimmed to limit RSS) case 5: return 128; // 256B case 6: return 128; // 512B default: return 64; // 1KB } } // Alias for tiny_default_cap int tiny_mag_default_cap(int class_idx) { return tiny_default_cap(class_idx); } // Maximum allowed TLS magazine capacities per class int tiny_cap_max_for_class(int class_idx) { switch (class_idx) { case 0: return 2048; case 1: return 1024; case 2: return 768; case 3: return 512; case 4: return 160; case 5: return 256; case 6: return 128; default: return 64; } }