- Update build configuration and flags - Add missing header files and dependencies - Update TLS list implementation with proper scoping - Fix various compilation warnings and issues - Update debug ring and tiny allocation infrastructure - Update benchmark results documentation Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
72 lines
2.3 KiB
C
72 lines
2.3 KiB
C
/**
|
||
* hakmem_tiny_config.c
|
||
*
|
||
* Implementation of centralized Tiny configuration constants
|
||
*/
|
||
|
||
#include "hakmem_tiny_config.h"
|
||
|
||
// ============================================================================
|
||
// Fast Cache Configuration
|
||
// ============================================================================
|
||
|
||
// Factory defaults (“balanced”) – mutable at runtime
|
||
// Small classes (0..2) are given higher caps by default to favor hot small-size throughput.
|
||
static const uint16_t k_fast_cap_defaults_factory[TINY_NUM_CLASSES] = {
|
||
256, // Class 0: 8B (was 128)
|
||
256, // Class 1: 16B (was 128)
|
||
256, // Class 2: 32B (was 128)
|
||
128, // Class 3: 64B (reduced from 512 to limit RSS)
|
||
128, // Class 4: 128B (trimmed via ACE/TLS caps)
|
||
224, // Class 5: 256B (bench-optimized default)
|
||
128, // Class 6: 512B
|
||
48 // Class 7: 1KB (reduce superslab reliance)
|
||
};
|
||
|
||
uint16_t g_fast_cap_defaults[TINY_NUM_CLASSES] = {
|
||
256, 256, 256, 128, 128, 224, 128, 48
|
||
};
|
||
|
||
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;
|
||
}
|
||
}
|