Refill the thread-local free list: first reclaim any cross-thread frees * queued on owned pages, then grow a fresh page if still empty. */
| 241 | /* Refill the thread-local free list: first reclaim any cross-thread frees |
| 242 | * queued on owned pages, then grow a fresh page if still empty. */ |
| 243 | static void slab_refill(slab_state_t *s) { |
| 244 | for (slab_page_t *p = s->pages; p; p = p->next) { |
| 245 | slab_free_node_t *rf = atomic_exchange_explicit( |
| 246 | &p->remote_free_head, (slab_free_node_t *)NULL, memory_order_acquire); |
| 247 | while (rf) { |
| 248 | slab_free_node_t *next = rf->next; |
| 249 | rf->next = s->freelist; |
| 250 | s->freelist = rf; |
| 251 | rf = next; |
| 252 | } |
| 253 | } |
| 254 | if (s->freelist) { |
| 255 | return; |
| 256 | } |
| 257 | (void)slab_grow(s); |
| 258 | } |
| 259 | |
| 260 | /* Retire ownership and drop the owner guard for every page this thread owns. |
| 261 | * A page with no live chunks is freed immediately; a page still holding |
no test coverage detected