Files
hakmem/core/hakmem_tiny_remote_target.h

26 lines
813 B
C
Raw Normal View History

#ifndef HAKMEM_TINY_REMOTE_TARGET_H
#define HAKMEM_TINY_REMOTE_TARGET_H
#include <stdatomic.h>
#include <stdint.h>
// Forward declaration
typedef struct TinySlab TinySlab;
#define TINY_NUM_CLASSES 8
// Targeted remote-drain queue: Slabs with high remote free counts
// Background thread can drain these without blocking allocation hot path
extern int g_bg_remote_enable;
extern _Atomic uintptr_t g_remote_target_head[TINY_NUM_CLASSES];
extern _Atomic uint32_t g_remote_target_len[TINY_NUM_CLASSES];
extern int g_bg_remote_batch;
// Enqueue a slab for targeted remote drain (lock-free Treiber stack)
void remote_target_enqueue(int class_idx, TinySlab* slab);
// Dequeue a slab from remote drain queue (returns NULL if empty)
TinySlab* remote_target_pop(int class_idx);
#endif // HAKMEM_TINY_REMOTE_TARGET_H