| 222 | -----------------------------------------------------------------------------*/ |
| 223 | |
| 224 | static bool mi_region_is_suitable(const mem_region_t* region, int numa_node, bool allow_large ) { |
| 225 | // initialized at all? |
| 226 | mi_region_info_t info; |
| 227 | info.value = mi_atomic_load_relaxed(&((mem_region_t*)region)->info); |
| 228 | if (info.value==0) return false; |
| 229 | |
| 230 | // numa correct |
| 231 | if (numa_node >= 0) { // use negative numa node to always succeed |
| 232 | int rnode = info.x.numa_node; |
| 233 | if (rnode >= 0 && rnode != numa_node) return false; |
| 234 | } |
| 235 | |
| 236 | // check allow-large |
| 237 | if (!allow_large && info.x.is_large) return false; |
| 238 | |
| 239 | return true; |
| 240 | } |
| 241 | |
| 242 | |
| 243 | static bool mi_region_try_claim(int numa_node, size_t blocks, bool allow_large, mem_region_t** region, mi_bitmap_index_t* bit_idx, mi_os_tld_t* tld) |
no outgoing calls
no test coverage detected