Lines Matching defs:aset
71 static void affinity_set_free(affinity_set_t aset);
73 static void affinity_set_place(affinity_space_t aspc, affinity_set_t aset);
74 static void affinity_set_add(affinity_set_t aset, thread_t thread);
75 static affinity_set_t affinity_set_remove(affinity_set_t aset, thread_t thread);
120 affinity_set_t aset;
153 aset = thread->affinity_set;
154 if (aset != NULL) {
158 DBG("thread_affinity_set(%p,%u) removing from aset %p\n",
159 thread, tag, aset);
160 empty_aset = affinity_set_remove(aset, thread);
164 aset = affinity_set_find(aspc, tag);
165 if (aset != NULL) {
169 DBG("thread_affinity_set(%p,%u) found aset %p\n",
170 thread, tag, aset);
177 aset = empty_aset;
180 aset = affinity_set_alloc();
181 if (aset == NULL) {
187 DBG("thread_affinity_set(%p,%u) (re-)using aset %p\n",
188 thread, tag, aset);
189 aset->aset_tag = tag;
190 affinity_set_place(aspc, aset);
192 affinity_set_add(aset, thread);
199 * If we wound up not using an empty aset we created,
268 affinity_set_t aset;
283 aset, affinity_set_t, aset_affinities) {
286 aset->aset_tag < (uint32_t) info->min)
287 info->min = aset->aset_tag;
289 aset->aset_tag > (uint32_t) info->max)
290 info->max = aset->aset_tag;
306 affinity_set_t aset;
310 aset = parent->affinity_set;
311 DBG("thread_affinity_dup(%p,%p) aset %p\n", parent, child, aset);
312 if (aset == NULL) {
317 aspc = aset->aset_space;
322 affinity_set_add(aset, child);
336 affinity_set_t aset = thread->affinity_set;
341 aspc = aset->aset_space;
343 if (affinity_set_remove(aset, thread)) {
344 affinity_set_free(aset);
401 affinity_set_t aset;
403 aset = (affinity_set_t) kalloc(sizeof(struct affinity_set));
404 if (aset == NULL)
407 aset->aset_thread_count = 0;
408 queue_init(&aset->aset_affinities);
409 queue_init(&aset->aset_threads);
410 aset->aset_num = 0;
411 aset->aset_pset = PROCESSOR_SET_NULL;
412 aset->aset_space = NULL;
414 DBG("affinity_set_create() returns %p\n", aset);
415 return aset;
423 affinity_set_free(affinity_set_t aset)
425 assert(queue_empty(&aset->aset_threads));
427 DBG("affinity_set_free(%p)\n", aset);
428 kfree(aset, sizeof(struct affinity_set));
436 affinity_set_add(affinity_set_t aset, thread_t thread)
440 DBG("affinity_set_add(%p,%p)\n", aset, thread);
441 queue_enter(&aset->aset_threads,
443 aset->aset_thread_count++;
446 thread->affinity_set = affinity_sets_enabled ? aset : NULL;
456 affinity_set_remove(affinity_set_t aset, thread_t thread)
466 aset->aset_thread_count--;
467 queue_remove(&aset->aset_threads,
469 if (queue_empty(&aset->aset_threads)) {
470 queue_remove(&aset->aset_space->aspc_affinities,
471 aset, affinity_set_t, aset_affinities);
472 assert(aset->aset_thread_count == 0);
473 aset->aset_tag = THREAD_AFFINITY_TAG_NULL;
474 aset->aset_num = 0;
475 aset->aset_pset = PROCESSOR_SET_NULL;
476 aset->aset_space = NULL;
477 DBG("affinity_set_remove(%p,%p) set now empty\n", aset, thread);
478 return aset;
480 DBG("affinity_set_remove(%p,%p)\n", aset, thread);
492 affinity_set_t aset;
495 aset, affinity_set_t, aset_affinities) {
496 if (aset->aset_tag == tag) {
498 space, tag, aset);
499 return aset;
520 affinity_set_t aset;
530 aset, affinity_set_t, aset_affinities) {
531 if(aset->aset_num < num_cpu_asets)
532 set_occupancy[aset->aset_num]++;
534 panic("aset_num = %d in %s\n", aset->aset_num, __FUNCTION__);