Lines Matching defs:aspc
69 static void affinity_space_free(affinity_space_t aspc);
72 static affinity_set_t affinity_set_find(affinity_space_t aspc, uint32_t tag);
73 static void affinity_set_place(affinity_space_t aspc, affinity_set_t aset);
122 affinity_space_t aspc;
128 aspc = thread->task->affinity_space;
129 if (aspc == NULL) {
139 aspc = thread->task->affinity_space;
152 lck_mtx_lock(&aspc->aspc_lock);
164 aset = affinity_set_find(aspc, tag);
182 lck_mtx_unlock(&aspc->aspc_lock);
190 affinity_set_place(aspc, aset);
195 lck_mtx_unlock(&aspc->aspc_lock);
218 affinity_space_t aspc = parent_task->affinity_space;
222 assert(aspc);
228 lck_mtx_lock(&aspc->aspc_lock);
229 aspc->aspc_task_count++;
230 child_task->affinity_space = aspc;
231 lck_mtx_unlock(&aspc->aspc_lock);
241 affinity_space_t aspc = task->affinity_space;
243 DBG("task_affinity_deallocate(%p) aspc %p task_count %d\n",
244 task, aspc, aspc->aspc_task_count);
246 lck_mtx_lock(&aspc->aspc_lock);
247 if (--(aspc->aspc_task_count) == 0) {
248 assert(queue_empty(&aspc->aspc_affinities));
249 lck_mtx_unlock(&aspc->aspc_lock);
250 affinity_space_free(aspc);
252 lck_mtx_unlock(&aspc->aspc_lock);
269 affinity_space_t aspc;
279 aspc = task->affinity_space;
280 if (aspc) {
281 lck_mtx_lock(&aspc->aspc_lock);
282 queue_iterate(&aspc->aspc_affinities,
292 info->task_count = aspc->aspc_task_count;
293 lck_mtx_unlock(&aspc->aspc_lock);
307 affinity_space_t aspc;
317 aspc = aset->aset_space;
318 assert(aspc == parent->task->affinity_space);
319 assert(aspc == child->task->affinity_space);
321 lck_mtx_lock(&aspc->aspc_lock);
323 lck_mtx_unlock(&aspc->aspc_lock);
337 affinity_space_t aspc;
341 aspc = aset->aset_space;
342 lck_mtx_lock(&aspc->aspc_lock);
346 lck_mtx_unlock(&aspc->aspc_lock);
367 affinity_space_t aspc;
369 aspc = (affinity_space_t) kalloc(sizeof(struct affinity_space));
370 if (aspc == NULL)
373 lck_mtx_init(&aspc->aspc_lock, &task_lck_grp, &task_lck_attr);
374 queue_init(&aspc->aspc_affinities);
375 aspc->aspc_task_count = 1;
377 DBG("affinity_space_create() returns %p\n", aspc);
378 return aspc;
385 affinity_space_free(affinity_space_t aspc)
387 assert(queue_empty(&aspc->aspc_affinities));
389 DBG("affinity_space_free(%p)\n", aspc);
390 kfree(aspc, sizeof(struct affinity_space));
514 affinity_set_place(affinity_space_t aspc, affinity_set_t new_aset)
529 queue_iterate(&aspc->aspc_affinities,
541 * [(unsigned int)aspc % 127] % num_cpu_asets
547 i_least_occupied = (unsigned int)(((uintptr_t)aspc % 127) % num_cpu_asets);
561 new_aset->aset_space = aspc;
562 queue_enter(&aspc->aspc_affinities,
566 aspc, new_aset, new_aset->aset_num, new_aset->aset_pset);