Feat(phase9): Safe removal from legacy list on shared pool free (Task 2)
Added remove_superslab_from_legacy_head to safely unlink SuperSlabs from legacy g_superslab_heads when freed by shared_pool_release_slab. This prevents dangling pointers in the legacy backend if fallback allocation was used. Called after unlocking alloc_lock to avoid lock inversion.
This commit is contained in:
@ -1489,6 +1489,10 @@ shared_pool_release_slab(SuperSlab* ss, int slab_idx)
|
||||
|
||||
pthread_mutex_unlock(&g_shared_pool.alloc_lock);
|
||||
|
||||
// Remove from legacy backend list (if present) to prevent dangling pointers
|
||||
extern void remove_superslab_from_legacy_head(SuperSlab* ss);
|
||||
remove_superslab_from_legacy_head(ss);
|
||||
|
||||
// Free SuperSlab:
|
||||
// 1. Try LRU cache (hak_ss_lru_push) - lazy deallocation
|
||||
// 2. Or munmap if LRU is full - eager deallocation
|
||||
|
||||
Reference in New Issue
Block a user