Lines Matching refs:task
93 extern void task_deallocate_internal(task_t task, os_ref_count_t refs);
280 task_reference_grp(task_t task, task_grp_t grp) in task_reference_grp() argument
290 if (task == TASK_NULL) { in task_reference_grp()
294 task_require(task); in task_reference_grp()
302 lck_spin_lock(&task->ref_group_lock); in task_reference_grp()
313 find_external_refgrp(&task->ref_group[1], 1, true) : in task_reference_grp()
314 &task->ref_group[TASK_GRP_KERNEL]; in task_reference_grp()
320 find_external_refgrp(&task->ref_group[TASK_GRP_COUNT], DYNAMIC_COUNT, true) : in task_reference_grp()
321 &task->ref_group[grp]; in task_reference_grp()
325 os_ref_retain_raw(&task->ref_count.ref_count, refgrp); in task_reference_grp()
329 lck_spin_unlock(&task->ref_group_lock); in task_reference_grp()
334 task_deallocate_grp(task_t task, task_grp_t grp) in task_deallocate_grp() argument
345 if (task == TASK_NULL) { in task_deallocate_grp()
360 find_external_refgrp(&task->ref_group[1], 1, false) : in task_deallocate_grp()
361 &task->ref_group[TASK_GRP_KERNEL]; in task_deallocate_grp()
366 find_external_refgrp(&task->ref_group[TASK_GRP_COUNT], DYNAMIC_COUNT, false) : in task_deallocate_grp()
367 &task->ref_group[grp]; in task_deallocate_grp()
372 refs = os_ref_release_raw(&task->ref_count.ref_count, refgrp); in task_deallocate_grp()
375 task_deallocate_internal(task, refs); in task_deallocate_grp()
379 task_reference_external(task_t task) in task_reference_external() argument
381 task_reference_grp(task, TASK_GRP_EXTERNAL); in task_reference_external()
385 task_deallocate_external(task_t task) in task_deallocate_external() argument
387 task_deallocate_grp(task, TASK_GRP_EXTERNAL); in task_deallocate_external()
391 allocate_refgrp_default(task_t task) in allocate_refgrp_default() argument
394 task->ref_group = kalloc_type(struct os_refgrp, 2, in allocate_refgrp_default()
397 task->ref_group[TASK_GRP_KERNEL] = (struct os_refgrp) in allocate_refgrp_default()
400 os_ref_log_init(&task->ref_group[TASK_GRP_KERNEL]); in allocate_refgrp_default()
404 free_refgrp_default(task_t task) in free_refgrp_default() argument
406 os_ref_log_fini(&task->ref_group[TASK_GRP_KERNEL]); in free_refgrp_default()
408 kfree_type(struct os_refgrp, 2, task->ref_group); in free_refgrp_default()
412 allocate_refgrp_full(task_t task) in allocate_refgrp_full() argument
414 task->ref_group = kalloc_type(struct os_refgrp, in allocate_refgrp_full()
418 task->ref_group[i] = (struct os_refgrp) in allocate_refgrp_full()
421 os_ref_log_init(&task->ref_group[i]); in allocate_refgrp_full()
426 free_refgrp_full(task_t task) in free_refgrp_full() argument
429 os_ref_log_fini(&task->ref_group[i]); in free_refgrp_full()
431 kfree_type(struct os_refgrp, TASK_GRP_COUNT + DYNAMIC_COUNT, task->ref_group); in free_refgrp_full()
435 task_ref_count_init(task_t task) in task_ref_count_init() argument
444 os_ref_init_count(&task->ref_count, &task_primary_refgrp, in task_ref_count_init()
450 allocate_refgrp_default(task); in task_ref_count_init()
451 lck_spin_init(&task->ref_group_lock, &task_lck_grp, LCK_ATTR_NULL); in task_ref_count_init()
452 os_ref_init_count(&task->ref_count, &task->ref_group[TASK_GRP_KERNEL], in task_ref_count_init()
457 allocate_refgrp_full(task); in task_ref_count_init()
458 lck_spin_init(&task->ref_group_lock, &task_lck_grp, LCK_ATTR_NULL); in task_ref_count_init()
460 os_ref_init_count_internal(&task->ref_count.ref_count, in task_ref_count_init()
461 &task->ref_group[TASK_GRP_KERNEL], 1); in task_ref_count_init()
463 task_reference_grp(task, TASK_GRP_INTERNAL); in task_ref_count_init()
470 task_ref_count_fini(task_t task) in task_ref_count_fini() argument
482 lck_spin_destroy(&task->ref_group_lock, &task_lck_grp); in task_ref_count_fini()
483 free_refgrp_default(task); in task_ref_count_fini()
487 lck_spin_destroy(&task->ref_group_lock, &task_lck_grp); in task_ref_count_fini()
488 free_refgrp_full(task); in task_ref_count_fini()
521 task_ref_count_init(task_t task) in task_ref_count_init() argument
524 os_ref_init_count(&task->ref_count, &task_primary_refgrp, in task_ref_count_init()
530 task_reference_grp(task_t task, __attribute__((__unused__)) task_grp_t grp) in task_reference_grp() argument
532 if (task == TASK_NULL) { in task_reference_grp()
536 task_require(task); in task_reference_grp()
537 os_ref_retain(&task->ref_count); in task_reference_grp()
541 task_deallocate_grp(task_t task, __attribute__((__unused__)) task_grp_t grp) in task_deallocate_grp() argument
543 if (task == TASK_NULL) { in task_deallocate_grp()
547 os_ref_count_t refs = os_ref_release(&task->ref_count); in task_deallocate_grp()
548 task_deallocate_internal(task, refs); in task_deallocate_grp()
552 task_reference_external(task_t task) in task_reference_external() argument
554 task_reference_grp(task, 0); in task_reference_external()
558 task_deallocate_external(task_t task) in task_deallocate_external() argument
560 task_deallocate_grp(task, 0); in task_deallocate_external()
564 task_ref_count_fini(__attribute__((__unused__)) task_t task) in task_ref_count_fini() argument