Guard madvise ENOMEM and stabilize pool/tiny front v3
This commit is contained in:
@ -9,6 +9,9 @@ typedef struct {
|
||||
uint16_t thread_id; // low bits of thread id (best-effort)
|
||||
} AllocEvent;
|
||||
|
||||
// Forward decl (defined in ss_os_acquire_box.h)
|
||||
extern int ss_os_madvise_guarded(void* ptr, size_t len, int advice, const char* where);
|
||||
|
||||
#define EVENTQ_CAP 65536u
|
||||
#define EVENTQ_MASK (EVENTQ_CAP - 1u)
|
||||
static _Atomic uint32_t g_ev_tail = 0;
|
||||
@ -689,7 +692,7 @@ static inline void superslab_partial_release(SuperSlab* ss, uint32_t epoch) {
|
||||
uint32_t prev = ss->partial_epoch;
|
||||
if (epoch != 0 && (epoch - prev) < g_ss_partial_interval) return;
|
||||
size_t len = (size_t)1 << ss->lg_size;
|
||||
if (madvise(ss, len, MADV_DONTNEED) == 0) {
|
||||
if (ss_os_madvise_guarded(ss, len, MADV_DONTNEED, "tiny_ss_partial") == 0) {
|
||||
ss->partial_epoch = epoch;
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user