Lock-free. Returns the slab page whose base == (ptr & mask), or NULL if the * masked base is not a registered slab page (i.e. ptr is a plain heap block). */
| 147 | /* Lock-free. Returns the slab page whose base == (ptr & mask), or NULL if the |
| 148 | * masked base is not a registered slab page (i.e. ptr is a plain heap block). */ |
| 149 | static slab_page_t *slab_map_lookup(uintptr_t base) { |
| 150 | size_t i1, i2, i3; |
| 151 | if (!slab_map_indices(base, &i1, &i2, &i3)) { |
| 152 | return NULL; |
| 153 | } |
| 154 | slab_map_l2_t *l2 = atomic_load_explicit(&g_slab_map_root[i1], memory_order_acquire); |
| 155 | if (!l2) { |
| 156 | return NULL; |
| 157 | } |
| 158 | slab_map_l3_t *l3 = atomic_load_explicit(&l2->e[i2], memory_order_acquire); |
| 159 | if (!l3) { |
| 160 | return NULL; |
| 161 | } |
| 162 | return atomic_load_explicit(&l3->e[i3], memory_order_acquire); |
| 163 | } |
| 164 | |
| 165 | /* Cold path. Sets the leaf entry for `base` to `val` (page to register, NULL to |
| 166 | * unregister), allocating intermediate tables on demand. Returns false only if |
no test coverage detected