Lines Matching refs:thread
215 static SECURITY_READ_ONLY_LATE(struct thread) thread_template = {
243 static struct thread init_thread;
251 size_t size = sizeof(struct thread); in thread_zone_startup()
254 size += roundup(uthread_size, _Alignof(struct thread)); in thread_zone_startup()
261 static void thread_deallocate_enqueue(thread_t thread);
262 static void thread_deallocate_complete(thread_t thread);
264 static void ctid_table_remove(thread_t thread);
265 static void ctid_table_add(thread_t thread);
329 init_thread_from_template(thread_t thread) in init_thread_from_template() argument
343 memcpy(thread, &thread_template, sizeof(*thread)); in init_thread_from_template()
418 thread_is_active(thread_t thread) in thread_is_active() argument
420 return thread->active; in thread_is_active()
426 thread_t thread = current_thread(); in thread_corpse_continue() local
428 thread_terminate_internal(thread); in thread_corpse_continue()
434 assert(thread->active == FALSE); in thread_corpse_continue()
435 thread_ast_clear(thread, AST_APC); in thread_corpse_continue()
436 thread_apc_ast(thread); in thread_corpse_continue()
456 thread_t thread = current_thread(); in thread_terminate_self() local
457 thread_ro_t tro = get_thread_ro(thread); in thread_terminate_self()
462 pal_thread_terminate_self(thread); in thread_terminate_self()
466 thread_mtx_lock(thread); in thread_terminate_self()
468 ipc_thread_disable(thread); in thread_terminate_self()
470 thread_mtx_unlock(thread); in thread_terminate_self()
472 thread_sched_call(thread, NULL); in thread_terminate_self()
475 thread_lock(thread); in thread_terminate_self()
477 thread_depress_abort_locked(thread); in thread_terminate_self()
490 thread_reset_pcs_ack_IPI(thread); in thread_terminate_self()
492 thread_unlock(thread); in thread_terminate_self()
497 thead_remove_taskwatch(thread); in thread_terminate_self()
500 work_interval_thread_terminate(thread); in thread_terminate_self()
502 thread_mtx_lock(thread); in thread_terminate_self()
504 thread_policy_reset(thread); in thread_terminate_self()
506 thread_mtx_unlock(thread); in thread_terminate_self()
508 assert(thread->th_work_interval == NULL); in thread_terminate_self()
510 bank_swap_thread_bank_ledger(thread, NULL); in thread_terminate_self()
512 if (kdebug_enable && bsd_hasthreadname(get_bsdthread_info(thread))) { in thread_terminate_self()
514 bsd_getthreadname(get_bsdthread_info(thread), threadname); in thread_terminate_self()
518 uthread_cleanup(get_bsdthread_info(thread), tro); in thread_terminate_self()
632 exclaves_thread_terminate(thread); in thread_terminate_self()
635 if (thread->th_vm_faults_disabled) { in thread_terminate_self()
636 panic("Thread %p terminating with vm_faults disabled.", thread); in thread_terminate_self()
640 thread_lock(thread); in thread_terminate_self()
649 assert((thread->sched_flags & TH_SFLAG_DEPRESSED_MASK) == 0); in thread_terminate_self()
653 while (thread->depress_timer_active > 0) { in thread_terminate_self()
654 thread_unlock(thread); in thread_terminate_self()
662 thread, thread->depress_timer_active); in thread_terminate_self()
666 thread_lock(thread); in thread_terminate_self()
673 if (thread->wait_timer_armed) { in thread_terminate_self()
674 thread->wait_timer_armed = false; in thread_terminate_self()
676 if (timer_call_cancel(thread->wait_timer)) { in thread_terminate_self()
677 thread->wait_timer_active--; in thread_terminate_self()
683 while (thread->wait_timer_active > 0) { in thread_terminate_self()
684 thread_unlock(thread); in thread_terminate_self()
693 thread, thread->wait_timer_active, in thread_terminate_self()
694 thread->wait_timer_armed); in thread_terminate_self()
698 thread_lock(thread); in thread_terminate_self()
704 if (thread->reserved_stack != 0) { in thread_terminate_self()
705 stack_free_reserved(thread); in thread_terminate_self()
706 thread->reserved_stack = 0; in thread_terminate_self()
712 thread->state |= TH_TERMINATE; in thread_terminate_self()
713 thread_mark_wait_locked(thread, THREAD_UNINT); in thread_terminate_self()
716 assert(thread->th_exclaves_ipc_ctx.ipcb == NULL); in thread_terminate_self()
717 assert(thread->th_exclaves_ipc_ctx.scid == 0); in thread_terminate_self()
718 assert(thread->th_exclaves_intstate == 0); in thread_terminate_self()
719 assert(thread->th_exclaves_state == 0); in thread_terminate_self()
721 assert(thread->th_work_interval_flags == TH_WORK_INTERVAL_FLAGS_NONE); in thread_terminate_self()
722 assert(thread->kern_promotion_schedpri == 0); in thread_terminate_self()
723 if (thread->rwlock_count > 0) { in thread_terminate_self()
724 …rwlock_count is %d for thread %p, possibly it still holds a rwlock", thread->rwlock_count, thread); in thread_terminate_self()
726 assert(thread->priority_floor_count == 0); in thread_terminate_self()
727 assert(thread->handoff_thread == THREAD_NULL); in thread_terminate_self()
728 assert(thread->th_work_interval == NULL); in thread_terminate_self()
729 assert(thread->t_rr_state.trr_value == 0); in thread_terminate_self()
731 assert(thread->th_test_ctx == NULL); in thread_terminate_self()
734 assert3u(0, ==, thread->sched_flags & in thread_terminate_self()
742 thread_unlock(thread); in thread_terminate_self()
750 thread_ref_release(thread_t thread) in thread_ref_release() argument
752 if (thread == THREAD_NULL) { in thread_ref_release()
756 assert_thread_magic(thread); in thread_ref_release()
758 return os_ref_release_raw(&thread->ref_count, &thread_refgrp) == 0; in thread_ref_release()
763 thread_deallocate_safe(thread_t thread) in thread_deallocate_safe() argument
765 if (__improbable(thread_ref_release(thread))) { in thread_deallocate_safe()
767 thread_deallocate_enqueue(thread); in thread_deallocate_safe()
772 thread_deallocate(thread_t thread) in thread_deallocate() argument
774 if (__improbable(thread_ref_release(thread))) { in thread_deallocate()
775 thread_deallocate_complete(thread); in thread_deallocate()
781 thread_t thread) in thread_deallocate_complete() argument
785 assert_thread_magic(thread); in thread_deallocate_complete()
787 assert(os_ref_get_count_raw(&thread->ref_count) == 0); in thread_deallocate_complete()
789 if (!(thread->state & TH_TERMINATE2)) { in thread_deallocate_complete()
793 thread_assert_runq_null(thread); in thread_deallocate_complete()
794 assert(!(thread->state & TH_WAKING)); in thread_deallocate_complete()
797 kpc_thread_destroy(thread); in thread_deallocate_complete()
800 ipc_thread_terminate(thread); in thread_deallocate_complete()
802 proc_thread_qos_deallocate(thread); in thread_deallocate_complete()
804 task = get_threadtask(thread); in thread_deallocate_complete()
807 uthread_destroy(get_bsdthread_info(thread)); in thread_deallocate_complete()
810 if (thread->t_ledger) { in thread_deallocate_complete()
811 ledger_dereference(thread->t_ledger); in thread_deallocate_complete()
813 if (thread->t_threadledger) { in thread_deallocate_complete()
814 ledger_dereference(thread->t_threadledger); in thread_deallocate_complete()
817 assert(thread->turnstile != TURNSTILE_NULL); in thread_deallocate_complete()
818 if (thread->turnstile) { in thread_deallocate_complete()
819 turnstile_deallocate(thread->turnstile); in thread_deallocate_complete()
821 turnstile_compact_id_put(thread->ctsid); in thread_deallocate_complete()
823 if (IPC_VOUCHER_NULL != thread->ith_voucher) { in thread_deallocate_complete()
824 ipc_voucher_release(thread->ith_voucher); in thread_deallocate_complete()
827 kfree_data(thread->thread_io_stats, sizeof(struct io_stat_info)); in thread_deallocate_complete()
829 if (thread->old_preadopt_thread_group) { in thread_deallocate_complete()
830 thread_group_release(thread->old_preadopt_thread_group); in thread_deallocate_complete()
833 if (thread->preadopt_thread_group) { in thread_deallocate_complete()
834 thread_group_release(thread->preadopt_thread_group); in thread_deallocate_complete()
838 if (thread->kernel_stack != 0) { in thread_deallocate_complete()
839 stack_free(thread); in thread_deallocate_complete()
842 recount_thread_deinit(&thread->th_recount); in thread_deallocate_complete()
844 lck_mtx_destroy(&thread->mutex, &thread_lck_grp); in thread_deallocate_complete()
845 machine_thread_destroy(thread); in thread_deallocate_complete()
850 assert_thread_magic(thread); in thread_deallocate_complete()
851 thread->thread_magic = 0; in thread_deallocate_complete()
856 queue_remove(&terminated_threads, thread, thread_t, threads); in thread_deallocate_complete()
860 timer_call_free(thread->depress_timer); in thread_deallocate_complete()
861 timer_call_free(thread->wait_timer); in thread_deallocate_complete()
863 ctid_table_remove(thread); in thread_deallocate_complete()
865 thread_ro_destroy(thread); in thread_deallocate_complete()
866 zfree(thread_zone, thread); in thread_deallocate_complete()
905 thread_t thread; in thread_exception_queue_invoke() local
913 thread = elt->exception_thread; in thread_exception_queue_invoke()
914 assert_thread_magic(thread); in thread_exception_queue_invoke()
926 thread_deallocate(thread); in thread_exception_queue_invoke()
929 task_deliver_crash_notification(task, thread, etype, 0); in thread_exception_queue_invoke()
973 thread_t thread, in thread_exception_enqueue() argument
980 elt->exception_thread = thread; in thread_exception_enqueue()
1033 thread_t thread = mpsc_queue_element(e, struct thread, mpsc_links); in thread_terminate_queue_invoke() local
1034 task_t task = get_threadtask(thread); in thread_terminate_queue_invoke()
1049 if (__improbable(thread->inspection)) { in thread_terminate_queue_invoke()
1053 enqueue_tail(&crashed_threads_queue, &thread->runq_links); in thread_terminate_queue_invoke()
1058 recount_task_rollup_thread(&task->tk_recount, &thread->th_recount); in thread_terminate_queue_invoke()
1060 task->total_runnable_time += timer_grab(&thread->runnable_timer); in thread_terminate_queue_invoke()
1061 task->c_switch += thread->c_switch; in thread_terminate_queue_invoke()
1062 task->p_switch += thread->p_switch; in thread_terminate_queue_invoke()
1063 task->ps_switch += thread->ps_switch; in thread_terminate_queue_invoke()
1065 task->syscalls_unix += thread->syscalls_unix; in thread_terminate_queue_invoke()
1066 task->syscalls_mach += thread->syscalls_mach; in thread_terminate_queue_invoke()
1068 task->task_timer_wakeups_bin_1 += thread->thread_timer_wakeups_bin_1; in thread_terminate_queue_invoke()
1069 task->task_timer_wakeups_bin_2 += thread->thread_timer_wakeups_bin_2; in thread_terminate_queue_invoke()
1070 task->task_gpu_ns += ml_gpu_stat(thread); in thread_terminate_queue_invoke()
1071 task->decompressions += thread->decompressions; in thread_terminate_queue_invoke()
1073 thread_update_qos_cpu_time(thread); in thread_terminate_queue_invoke()
1075 queue_remove(&task->threads, thread, thread_t, task_threads); in thread_terminate_queue_invoke()
1089 queue_remove(&threads, thread, thread_t, threads); in thread_terminate_queue_invoke()
1091 queue_enter(&terminated_threads, thread, thread_t, threads); in thread_terminate_queue_invoke()
1105 if (thread_get_tag(thread) & THREAD_TAG_USER_JOIN) { in thread_terminate_queue_invoke()
1106 struct uthread *uth = get_bsdthread_info(thread); in thread_terminate_queue_invoke()
1123 thread_deallocate(thread); in thread_terminate_queue_invoke()
1130 thread_t thread = mpsc_queue_element(e, struct thread, mpsc_links); in thread_deallocate_queue_invoke() local
1134 thread_deallocate_complete(thread); in thread_deallocate_queue_invoke()
1146 thread_t thread) in thread_terminate_enqueue() argument
1148 KDBG_RELEASE(TRACE_DATA_THREAD_TERMINATE, thread->thread_id); in thread_terminate_enqueue()
1150 mpsc_daemon_enqueue(&thread_terminate_queue, &thread->mpsc_links, in thread_terminate_enqueue()
1161 thread_t thread) in thread_deallocate_enqueue() argument
1163 mpsc_daemon_enqueue(&thread_deallocate_queue, &thread->mpsc_links, in thread_deallocate_enqueue()
1207 thread_t thread = mpsc_queue_element(elm, struct thread, mpsc_links); in thread_stack_queue_invoke() local
1212 stack_alloc(thread); in thread_stack_queue_invoke()
1214 …TANT(MACHDBG_CODE(DBG_MACH_SCHED, MACH_STACK_WAIT) | DBG_FUNC_END, thread_tid(thread), 0, 0, 0, 0); in thread_stack_queue_invoke()
1217 thread_lock(thread); in thread_stack_queue_invoke()
1218 thread_setrun(thread, SCHED_PREEMPT | SCHED_TAILQ); in thread_stack_queue_invoke()
1219 thread_unlock(thread); in thread_stack_queue_invoke()
1232 thread_t thread) in thread_stack_enqueue() argument
1234 …NT(MACHDBG_CODE(DBG_MACH_SCHED, MACH_STACK_WAIT) | DBG_FUNC_START, thread_tid(thread), 0, 0, 0, 0); in thread_stack_enqueue()
1235 assert_thread_magic(thread); in thread_stack_enqueue()
1237 mpsc_daemon_enqueue(&thread_stack_queue, &thread->mpsc_links, in thread_stack_enqueue()
1291 main_thread_set_immovable_pinned(thread_t thread) in main_thread_set_immovable_pinned() argument
1293 ipc_main_thread_set_immovable_pinned(thread); in main_thread_set_immovable_pinned()
1637 thread_t thread; in thread_create_with_options_internal() local
1650 result = thread_create_internal(task, -1, continuation, NULL, options, &thread); in thread_create_with_options_internal()
1655 thread->user_stop_count = 1; in thread_create_with_options_internal()
1656 thread_hold(thread); in thread_create_with_options_internal()
1658 thread_hold(thread); in thread_create_with_options_internal()
1668 *new_thread = thread; in thread_create_with_options_internal()
1714 thread_t thread; in thread_create_waiting_internal() local
1722 options, &thread); in thread_create_waiting_internal()
1730 thread_hold(thread); in thread_create_waiting_internal()
1733 thread_mtx_lock(thread); in thread_create_waiting_internal()
1734 thread_set_pending_block_hint(thread, block_hint); in thread_create_waiting_internal()
1736 thread->static_param = true; in thread_create_waiting_internal()
1737 event = workq_thread_init_and_wq_lock(task, thread); in thread_create_waiting_internal()
1741 thread_start_in_assert_wait(thread, in thread_create_waiting_internal()
1744 thread_mtx_unlock(thread); in thread_create_waiting_internal()
1749 *new_thread = thread; in thread_create_waiting_internal()
1776 thread_t thread; in thread_create_running_internal2() local
1791 TH_OPTION_NONE, &thread); in thread_create_running_internal2()
1797 thread_hold(thread); in thread_create_running_internal2()
1801 result = machine_thread_state_convert_from_user(thread, flavor, in thread_create_running_internal2()
1805 result = machine_thread_set_state(thread, flavor, new_state, in thread_create_running_internal2()
1812 thread_terminate(thread); in thread_create_running_internal2()
1813 thread_deallocate(thread); in thread_create_running_internal2()
1817 thread_mtx_lock(thread); in thread_create_running_internal2()
1818 thread_start(thread); in thread_create_running_internal2()
1819 thread_mtx_unlock(thread); in thread_create_running_internal2()
1828 *new_thread = thread; in thread_create_running_internal2()
1911 thread_t thread; in kernel_thread_create() local
1915 TH_OPTION_NONE, &thread); in kernel_thread_create()
1923 stack_alloc(thread); in kernel_thread_create()
1924 assert(thread->kernel_stack != 0); in kernel_thread_create()
1928 thread->reserved_stack = thread->kernel_stack; in kernel_thread_create()
1931 kprintf("kernel_thread_create: thread = %p continuation = %p\n", thread, continuation); in kernel_thread_create()
1933 *new_thread = thread; in kernel_thread_create()
1946 thread_t thread; in kernel_thread_start_priority() local
1948 result = kernel_thread_create(continuation, parameter, priority, &thread); in kernel_thread_start_priority()
1953 *new_thread = thread; in kernel_thread_start_priority()
1955 thread_mtx_lock(thread); in kernel_thread_start_priority()
1956 thread_start(thread); in kernel_thread_start_priority()
1957 thread_mtx_unlock(thread); in kernel_thread_start_priority()
1974 retrieve_thread_basic_info(thread_t thread, thread_basic_info_t basic_info) in retrieve_thread_basic_info() argument
1980 thread_read_times(thread, &basic_info->user_time, in retrieve_thread_basic_info()
1986 if (SCHED(can_update_priority)(thread)) { in retrieve_thread_basic_info()
1987 SCHED(update_priority)(thread); in retrieve_thread_basic_info()
2000 basic_info->cpu_usage = (integer_t)(((uint64_t)thread->cpu_usage in retrieve_thread_basic_info()
2010 basic_info->policy = ((thread->sched_mode == TH_MODE_TIMESHARE)? in retrieve_thread_basic_info()
2014 if (thread->options & TH_OPT_IDLE_THREAD) { in retrieve_thread_basic_info()
2018 if (thread->options & TH_OPT_GLOBAL_FORCED_IDLE) { in retrieve_thread_basic_info()
2022 if (!thread->kernel_stack) { in retrieve_thread_basic_info()
2027 if (thread->state & TH_TERMINATE) { in retrieve_thread_basic_info()
2029 } else if (thread->state & TH_RUN) { in retrieve_thread_basic_info()
2031 } else if (thread->state & TH_UNINT) { in retrieve_thread_basic_info()
2033 } else if (thread->state & TH_SUSP) { in retrieve_thread_basic_info()
2035 } else if (thread->state & TH_WAIT) { in retrieve_thread_basic_info()
2042 basic_info->suspend_count = thread->user_stop_count; in retrieve_thread_basic_info()
2049 thread_t thread, in thread_info_internal() argument
2056 if (thread == THREAD_NULL) { in thread_info_internal()
2066 thread_lock(thread); in thread_info_internal()
2068 retrieve_thread_basic_info(thread, (thread_basic_info_t) thread_info_out); in thread_info_internal()
2070 thread_unlock(thread); in thread_info_internal()
2086 thread_lock(thread); in thread_info_internal()
2088 identifier_info->thread_id = thread->thread_id; in thread_info_internal()
2089 identifier_info->thread_handle = thread->machine.cthread_self; in thread_info_internal()
2090 identifier_info->dispatch_qaddr = thread_dispatchqaddr(thread); in thread_info_internal()
2092 thread_unlock(thread); in thread_info_internal()
2105 thread_lock(thread); in thread_info_internal()
2107 if (thread->sched_mode != TH_MODE_TIMESHARE) { in thread_info_internal()
2108 thread_unlock(thread); in thread_info_internal()
2113 ts_info->depressed = (thread->sched_flags & TH_SFLAG_DEPRESSED_MASK) != 0; in thread_info_internal()
2116 ts_info->depress_priority = thread->base_pri; in thread_info_internal()
2118 ts_info->base_priority = thread->base_pri; in thread_info_internal()
2122 ts_info->cur_priority = thread->sched_pri; in thread_info_internal()
2123 ts_info->max_priority = thread->max_priority; in thread_info_internal()
2125 thread_unlock(thread); in thread_info_internal()
2149 thread_lock(thread); in thread_info_internal()
2151 if (thread->sched_mode == TH_MODE_TIMESHARE) { in thread_info_internal()
2152 thread_unlock(thread); in thread_info_internal()
2158 rr_info->depressed = (thread->sched_flags & TH_SFLAG_DEPRESSED_MASK) != 0; in thread_info_internal()
2161 rr_info->depress_priority = thread->base_pri; in thread_info_internal()
2163 rr_info->base_priority = thread->base_pri; in thread_info_internal()
2170 rr_info->max_priority = thread->max_priority; in thread_info_internal()
2173 thread_unlock(thread); in thread_info_internal()
2188 thread_lock(thread); in thread_info_internal()
2193 retrieve_thread_basic_info(thread, &basic_info); in thread_info_internal()
2202 extended_info->pth_curpri = thread->sched_pri; in thread_info_internal()
2203 extended_info->pth_priority = thread->base_pri; in thread_info_internal()
2204 extended_info->pth_maxpriority = thread->max_priority; in thread_info_internal()
2206 bsd_getthreadname(get_bsdthread_info(thread), extended_info->pth_name); in thread_info_internal()
2208 thread_unlock(thread); in thread_info_internal()
2226 dbg_info->page_creation_count = thread->t_page_creation_count; in thread_info_internal()
2249 thread_t thread, in thread_read_times() argument
2255 struct recount_times_mach times = recount_thread_times(thread); in thread_read_times()
2261 uint64_t runnable_time_mach = timer_grab(&thread->runnable_timer); in thread_read_times()
2288 thread_t thread, in thread_wire_internal() argument
2292 if (host_priv == NULL || thread != current_thread()) { in thread_wire_internal()
2297 *prev_state = (thread->options & TH_OPT_VMPRIV) != 0; in thread_wire_internal()
2301 if (!(thread->options & TH_OPT_VMPRIV)) { in thread_wire_internal()
2304 thread->options |= TH_OPT_VMPRIV; in thread_wire_internal()
2306 if (thread->options & TH_OPT_VMPRIV) { in thread_wire_internal()
2309 thread->options &= ~TH_OPT_VMPRIV; in thread_wire_internal()
2324 thread_t thread __unused, in thread_wire()
2363 thread_floor_boost_set_promotion_locked(thread_t thread) in thread_floor_boost_set_promotion_locked() argument
2365 assert(thread->priority_floor_count > 0); in thread_floor_boost_set_promotion_locked()
2367 if (!(thread->sched_flags & TH_SFLAG_FLOOR_PROMOTED)) { in thread_floor_boost_set_promotion_locked()
2368 sched_thread_promote_reason(thread, TH_SFLAG_FLOOR_PROMOTED, 0); in thread_floor_boost_set_promotion_locked()
2388 thread_t thread = current_thread(); in thread_priority_floor_start() local
2391 assert(thread->priority_floor_count < UINT16_MAX); in thread_priority_floor_start()
2392 prev_priority_floor_count = thread->priority_floor_count++; in thread_priority_floor_start()
2405 ret.thread = thread; in thread_priority_floor_start()
2417 thread_t thread = current_thread(); in thread_priority_floor_end() local
2419 assert(thread->priority_floor_count > 0); in thread_priority_floor_end()
2420 …token->thread == thread, "thread_priority_floor_end called from a different thread from thread_pri… in thread_priority_floor_end()
2422 if ((thread->priority_floor_count-- == 1) && (thread->sched_flags & TH_SFLAG_FLOOR_PROMOTED)) { in thread_priority_floor_end()
2424 thread_lock(thread); in thread_priority_floor_end()
2426 if (thread->sched_flags & TH_SFLAG_FLOOR_PROMOTED) { in thread_priority_floor_end()
2427 sched_thread_unpromote_reason(thread, TH_SFLAG_FLOOR_PROMOTED, 0); in thread_priority_floor_end()
2430 thread_unlock(thread); in thread_priority_floor_end()
2434 token->thread = NULL; in thread_priority_floor_end()
2441 thread_guard_violation(thread_t thread, in thread_guard_violation() argument
2444 assert(thread == current_thread()); in thread_guard_violation()
2450 if (get_threadtask(thread) == kernel_task) { in thread_guard_violation()
2463 if (thread->guard_exc_info.code && (thread->guard_exc_fatal || !fatal)) { in thread_guard_violation()
2467 thread->guard_exc_info.code = code; in thread_guard_violation()
2468 thread->guard_exc_info.subcode = subcode; in thread_guard_violation()
2469 thread->guard_exc_fatal = fatal ? 1 : 0; in thread_guard_violation()
2472 thread_ast_set(thread, AST_GUARD); in thread_guard_violation()
2473 ast_propagate(thread); in thread_guard_violation()
2540 thread_t thread = current_thread(); in SENDING_NOTIFICATION__THIS_THREAD_IS_CONSUMING_TOO_MUCH_CPU() local
2541 uint64_t tid = thread->thread_id; in SENDING_NOTIFICATION__THIS_THREAD_IS_CONSUMING_TOO_MUCH_CPU()
2561 assert(thread->t_threadledger != LEDGER_NULL); in SENDING_NOTIFICATION__THIS_THREAD_IS_CONSUMING_TOO_MUCH_CPU()
2596 thread_read_times(thread, &thread_user_time, &thread_system_time, NULL); in SENDING_NOTIFICATION__THIS_THREAD_IS_CONSUMING_TOO_MUCH_CPU()
2599 ledger_get_entry_info(thread->t_threadledger, thread_ledgers.cpu_time, &lei); in SENDING_NOTIFICATION__THIS_THREAD_IS_CONSUMING_TOO_MUCH_CPU()
2745 thread_update_io_stats(thread_t thread, int size, int io_flags) in thread_update_io_stats() argument
2747 task_t task = get_threadtask(thread); in thread_update_io_stats()
2750 if (thread->thread_io_stats == NULL || task->task_io_stats == NULL) { in thread_update_io_stats()
2755 UPDATE_IO_STATS(thread->thread_io_stats->disk_reads, size); in thread_update_io_stats()
2760 UPDATE_IO_STATS(thread->thread_io_stats->metadata, size); in thread_update_io_stats()
2765 UPDATE_IO_STATS(thread->thread_io_stats->paging, size); in thread_update_io_stats()
2772 UPDATE_IO_STATS(thread->thread_io_stats->io_priority[io_tier], size); in thread_update_io_stats()
2776 UPDATE_IO_STATS(thread->thread_io_stats->total_io, size); in thread_update_io_stats()
2820 thread_t thread = current_thread(); in thread_cpulimit_remaining() local
2822 if ((thread->options & in thread_cpulimit_remaining()
2829 ledger_get_interval_remaining(thread->t_threadledger, thread_ledgers.cpu_time, now); in thread_cpulimit_remaining()
2833 ledger_get_remaining(thread->t_threadledger, thread_ledgers.cpu_time); in thread_cpulimit_remaining()
2844 thread_t thread = current_thread(); in thread_cpulimit_interval_has_expired() local
2846 if ((thread->options & in thread_cpulimit_interval_has_expired()
2851 return ledger_get_interval_remaining(thread->t_threadledger, in thread_cpulimit_interval_has_expired()
2861 thread_t thread = current_thread(); in thread_cpulimit_restart() local
2863 assert3u(thread->options & (TH_OPT_PROC_CPULIMIT | TH_OPT_PRVT_CPULIMIT), !=, 0); in thread_cpulimit_restart()
2865 ledger_restart(thread->t_threadledger, thread_ledgers.cpu_time, now); in thread_cpulimit_restart()
2876 thread_t thread = current_thread(); in thread_get_cpulimit() local
2882 if (thread->t_threadledger == LEDGER_NULL) { in thread_get_cpulimit()
2890 ledger_get_period(thread->t_threadledger, thread_ledgers.cpu_time, interval_ns); in thread_get_cpulimit()
2891 ledger_get_limit(thread->t_threadledger, thread_ledgers.cpu_time, &abstime); in thread_get_cpulimit()
2908 if (thread->options & TH_OPT_PROC_CPULIMIT) { in thread_get_cpulimit()
2909 assert((thread->options & TH_OPT_PRVT_CPULIMIT) == 0); in thread_get_cpulimit()
2912 } else if (thread->options & TH_OPT_PRVT_CPULIMIT) { in thread_get_cpulimit()
2913 assert((thread->options & TH_OPT_PROC_CPULIMIT) == 0); in thread_get_cpulimit()
2929 thread_t thread = current_thread(); in thread_set_cpulimit() local
2941 if ((thread->options & TH_OPT_FORCED_LEDGER) != 0) { in thread_set_cpulimit()
2949 if (thread->t_threadledger != LEDGER_NULL) { in thread_set_cpulimit()
2950 l = thread->t_threadledger; in thread_set_cpulimit()
2953 thread->options &= ~(TH_OPT_PROC_CPULIMIT | TH_OPT_PRVT_CPULIMIT); in thread_set_cpulimit()
2963 l = thread->t_threadledger; in thread_set_cpulimit()
2976 thread->t_threadledger = l; in thread_set_cpulimit()
2996 if (thread->options & TH_OPT_PRVT_CPULIMIT) { in thread_set_cpulimit()
3006 thread->options |= TH_OPT_PROC_CPULIMIT; in thread_set_cpulimit()
3012 thread->options &= ~TH_OPT_PROC_CPULIMIT; in thread_set_cpulimit()
3014 thread->options |= TH_OPT_PRVT_CPULIMIT; in thread_set_cpulimit()
3025 thread_t thread, in thread_sched_call() argument
3028 assert((thread->state & TH_WAIT_REPORT) == 0); in thread_sched_call()
3029 thread->sched_call = call; in thread_sched_call()
3034 thread_t thread) in thread_tid() argument
3036 return thread != THREAD_NULL? thread->thread_id: 0; in thread_tid()
3091 thread_shared_rsrc_policy_get(thread_t thread, cluster_shared_rsrc_type_t type) in thread_shared_rsrc_policy_get() argument
3093 return thread->th_shared_rsrc_heavy_user[type] || thread->th_shared_rsrc_heavy_perf_control[type]; in thread_shared_rsrc_policy_get()
3102 thread_shared_rsrc_policy_set(thread_t thread, __unused uint32_t index, cluster_shared_rsrc_type_t … in thread_shared_rsrc_policy_set() argument
3105 thread_lock(thread); in thread_shared_rsrc_policy_set()
3108 …bool *thread_flags = (user) ? thread->th_shared_rsrc_heavy_user : thread->th_shared_rsrc_heavy_per… in thread_shared_rsrc_policy_set()
3110 thread_unlock(thread); in thread_shared_rsrc_policy_set()
3116 thread_unlock(thread); in thread_shared_rsrc_policy_set()
3119 …_HEAVY_THREAD) | DBG_FUNC_NONE, SCHED_EDGE_RSRC_HEAVY_THREAD_SET, thread_tid(thread), type, agent); in thread_shared_rsrc_policy_set()
3120 if (thread == current_thread()) { in thread_shared_rsrc_policy_set()
3132 thread_shared_rsrc_policy_clear(thread_t thread, cluster_shared_rsrc_type_t type, shared_rsrc_polic… in thread_shared_rsrc_policy_clear() argument
3135 thread_lock(thread); in thread_shared_rsrc_policy_clear()
3138 …bool *thread_flags = (user) ? thread->th_shared_rsrc_heavy_user : thread->th_shared_rsrc_heavy_per… in thread_shared_rsrc_policy_clear()
3140 thread_unlock(thread); in thread_shared_rsrc_policy_clear()
3146 thread_unlock(thread); in thread_shared_rsrc_policy_clear()
3149 …_HEAVY_THREAD) | DBG_FUNC_NONE, SCHED_EDGE_RSRC_HEAVY_THREAD_CLR, thread_tid(thread), type, agent); in thread_shared_rsrc_policy_clear()
3150 if (thread == current_thread()) { in thread_shared_rsrc_policy_clear()
3174 thread_shared_rsrc_policy_get(__unused thread_t thread, __unused cluster_shared_rsrc_type_t type) in thread_shared_rsrc_policy_get() argument
3180 thread_shared_rsrc_policy_set(thread_t thread, uint32_t index, __unused cluster_shared_rsrc_type_t … in thread_shared_rsrc_policy_set() argument
3182 return thread_bind_cluster_id(thread, index, THREAD_BIND_SOFT | THREAD_BIND_ELIGIBLE_ONLY); in thread_shared_rsrc_policy_set()
3186 thread_shared_rsrc_policy_clear(thread_t thread, __unused cluster_shared_rsrc_type_t type, __unused… in thread_shared_rsrc_policy_clear() argument
3188 return thread_bind_cluster_id(thread, 0, THREAD_UNBIND); in thread_shared_rsrc_policy_clear()
3195 thread_t thread) in thread_dispatchqaddr() argument
3201 if (thread == THREAD_NULL) { in thread_dispatchqaddr()
3205 thread_handle = thread->machine.cthread_self; in thread_dispatchqaddr()
3210 task = get_threadtask(thread); in thread_dispatchqaddr()
3212 if (thread->inspection == TRUE) { in thread_dispatchqaddr()
3225 thread_wqquantum_addr(thread_t thread) in thread_wqquantum_addr() argument
3230 if (thread == THREAD_NULL) { in thread_wqquantum_addr()
3234 thread_handle = thread->machine.cthread_self; in thread_wqquantum_addr()
3238 task = get_threadtask(thread); in thread_wqquantum_addr()
3250 thread_t thread) in thread_rettokern_addr() argument
3258 if (thread == THREAD_NULL) { in thread_rettokern_addr()
3262 thread_handle = thread->machine.cthread_self; in thread_rettokern_addr()
3266 task = get_threadtask(thread); in thread_rettokern_addr()
3291 thread_mtx_lock(thread_t thread) in thread_mtx_lock() argument
3293 lck_mtx_lock(&thread->mutex); in thread_mtx_lock()
3297 thread_mtx_unlock(thread_t thread) in thread_mtx_unlock() argument
3299 lck_mtx_unlock(&thread->mutex); in thread_mtx_unlock()
3304 thread_t thread) in thread_reference() argument
3306 if (thread != THREAD_NULL) { in thread_reference()
3307 zone_id_require(ZONE_ID_THREAD, sizeof(struct thread), thread); in thread_reference()
3308 os_ref_retain_raw(&thread->ref_count, &thread_refgrp); in thread_reference()
3313 thread_require(thread_t thread) in thread_require() argument
3315 zone_id_require(ZONE_ID_THREAD, sizeof(struct thread), thread); in thread_require()
3336 thread_t thread = current_thread(); in thread_set_voucher_name() local
3358 thread_mtx_lock(thread); in thread_set_voucher_name()
3359 voucher = thread->ith_voucher; in thread_set_voucher_name()
3360 thread->ith_voucher_name = voucher_name; in thread_set_voucher_name()
3361 thread->ith_voucher = new_voucher; in thread_set_voucher_name()
3362 thread_mtx_unlock(thread); in thread_set_voucher_name()
3364 bank_swap_thread_bank_ledger(thread, bankledger); in thread_set_voucher_name()
3366 thread_group_set_bank(thread, banktg); in thread_set_voucher_name()
3371 (uintptr_t)thread_tid(thread), in thread_set_voucher_name()
3393 thread_act_t thread, in thread_get_mach_voucher() argument
3399 if (THREAD_NULL == thread) { in thread_get_mach_voucher()
3403 thread_mtx_lock(thread); in thread_get_mach_voucher()
3404 voucher = thread->ith_voucher; in thread_get_mach_voucher()
3408 thread_mtx_unlock(thread); in thread_get_mach_voucher()
3413 thread_mtx_unlock(thread); in thread_get_mach_voucher()
3431 thread_t thread, in thread_set_mach_voucher() argument
3439 if (THREAD_NULL == thread) { in thread_set_mach_voucher()
3445 thread_mtx_lock(thread); in thread_set_mach_voucher()
3454 if (thread != current_thread() && thread->started) { in thread_set_mach_voucher()
3455 thread_mtx_unlock(thread); in thread_set_mach_voucher()
3460 old_voucher = thread->ith_voucher; in thread_set_mach_voucher()
3461 thread->ith_voucher = voucher; in thread_set_mach_voucher()
3462 thread->ith_voucher_name = MACH_PORT_NULL; in thread_set_mach_voucher()
3463 thread_mtx_unlock(thread); in thread_set_mach_voucher()
3465 bank_swap_thread_bank_ledger(thread, bankledger); in thread_set_mach_voucher()
3467 thread_group_set_bank(thread, banktg); in thread_set_mach_voucher()
3472 (uintptr_t)thread_tid(thread), in thread_set_mach_voucher()
3492 __unused thread_t thread, in thread_swap_mach_voucher() argument
3520 thread_get_voucher_origin_pid(thread_t thread, int32_t *pid) in thread_get_voucher_origin_pid() argument
3523 return mach_voucher_attr_command(thread->ith_voucher, in thread_get_voucher_origin_pid()
3536 thread_get_voucher_origin_proximate_pid(thread_t thread, int32_t *origin_pid, int32_t *proximate_pi… in thread_get_voucher_origin_proximate_pid() argument
3540 kern_return_t kr = mach_voucher_attr_command(thread->ith_voucher, in thread_get_voucher_origin_proximate_pid()
3562 thread_get_current_voucher_thread_group(thread_t thread) in thread_get_current_voucher_thread_group() argument
3564 assert(thread == current_thread()); in thread_get_current_voucher_thread_group()
3566 if (thread->ith_voucher == NULL) { in thread_get_current_voucher_thread_group()
3573 bank_get_bank_ledger_thread_group_and_persona(thread->ith_voucher, &bankledger, &banktg, NULL); in thread_get_current_voucher_thread_group()
3583 thread_get_current_voucher_resource_coalition_id(thread_t thread) in thread_get_current_voucher_resource_coalition_id() argument
3586 assert(thread == current_thread()); in thread_get_current_voucher_resource_coalition_id()
3587 if (thread->ith_voucher != NULL) { in thread_get_current_voucher_resource_coalition_id()
3588 id = bank_get_bank_ledger_resource_coalition_id(thread->ith_voucher); in thread_get_current_voucher_resource_coalition_id()
3617 thread_supports_cooperative_workqueue(thread_t thread) in thread_supports_cooperative_workqueue() argument
3619 struct uthread *uth = get_bsdthread_info(thread); in thread_supports_cooperative_workqueue()
3620 task_t task = get_threadtask(thread); in thread_supports_cooperative_workqueue()
3622 assert(thread == current_thread()); in thread_supports_cooperative_workqueue()
3629 thread_has_armed_workqueue_quantum(thread_t thread) in thread_has_armed_workqueue_quantum() argument
3631 return thread->workq_quantum_deadline != 0; in thread_has_armed_workqueue_quantum()
3651 thread_workq_quantum_size(thread_t thread) in thread_workq_quantum_size() argument
3653 return (uint64_t) (SCHED(initial_quantum_size)(thread) / 2); in thread_workq_quantum_size()
3662 thread_arm_workqueue_quantum(thread_t thread) in thread_arm_workqueue_quantum() argument
3669 if (!thread_supports_cooperative_workqueue(thread)) { in thread_arm_workqueue_quantum()
3670 assert(thread->workq_quantum_deadline == 0); in thread_arm_workqueue_quantum()
3674 assert(current_thread() == thread); in thread_arm_workqueue_quantum()
3675 assert(thread_get_tag(thread) & THREAD_TAG_WORKQUEUE); in thread_arm_workqueue_quantum()
3678 uint64_t deadline = thread_workq_quantum_size(thread) + current_runtime; in thread_arm_workqueue_quantum()
3685 thread->workq_quantum_deadline = deadline; in thread_arm_workqueue_quantum()
3688 act_clear_astkevent(thread, AST_KEVENT_WORKQ_QUANTUM_EXPIRED); in thread_arm_workqueue_quantum()
3692 WORKQ_QUANTUM_HISTORY_WRITE_ENTRY(thread, thread->workq_quantum_deadline, true); in thread_arm_workqueue_quantum()
3697 thread_disarm_workqueue_quantum(thread_t thread) in thread_disarm_workqueue_quantum() argument
3702 thread->workq_quantum_deadline = 0; in thread_disarm_workqueue_quantum()
3703 act_clear_astkevent(thread, AST_KEVENT_WORKQ_QUANTUM_EXPIRED); in thread_disarm_workqueue_quantum()
3707 WORKQ_QUANTUM_HISTORY_WRITE_ENTRY(thread, thread->workq_quantum_deadline, false); in thread_disarm_workqueue_quantum()
3714 thread_has_expired_workqueue_quantum(thread_t thread, bool should_trace) in thread_has_expired_workqueue_quantum() argument
3716 if (!thread_has_armed_workqueue_quantum(thread)) { in thread_has_expired_workqueue_quantum()
3726 uint64_t runtime = recount_thread_time_mach(thread); in thread_has_expired_workqueue_quantum()
3727 bool expired = runtime > thread->workq_quantum_deadline; in thread_has_expired_workqueue_quantum()
3730 WQ_TRACE(TRACE_wq_quantum_expired, runtime, thread->workq_quantum_deadline, 0, 0); in thread_has_expired_workqueue_quantum()
3741 thread_evaluate_workqueue_quantum_expiry(thread_t thread) in thread_evaluate_workqueue_quantum_expiry() argument
3743 if (thread_has_expired_workqueue_quantum(thread, true)) { in thread_evaluate_workqueue_quantum_expiry()
3744 act_set_astkevent(thread, AST_KEVENT_WORKQ_QUANTUM_EXPIRED); in thread_evaluate_workqueue_quantum_expiry()
3784 thread_get_runq(thread_t thread) in thread_get_runq() argument
3786 thread_lock_assert(thread, LCK_ASSERT_OWNED); in thread_get_runq()
3787 processor_t runq = thread->__runq.runq; in thread_get_runq()
3793 thread_get_runq_locked(thread_t thread) in thread_get_runq_locked() argument
3795 thread_lock_assert(thread, LCK_ASSERT_OWNED); in thread_get_runq_locked()
3796 processor_t runq = thread->__runq.runq; in thread_get_runq_locked()
3804 thread_set_runq_locked(thread_t thread, processor_t new_runq) in thread_set_runq_locked() argument
3806 thread_lock_assert(thread, LCK_ASSERT_OWNED); in thread_set_runq_locked()
3808 thread_assert_runq_null(thread); in thread_set_runq_locked()
3809 thread->__runq.runq = new_runq; in thread_set_runq_locked()
3813 thread_clear_runq(thread_t thread) in thread_clear_runq() argument
3815 thread_assert_runq_nonnull(thread); in thread_clear_runq()
3817 thread->__runq.runq = PROCESSOR_NULL; in thread_clear_runq()
3821 thread_clear_runq_locked(thread_t thread) in thread_clear_runq_locked() argument
3823 thread_lock_assert(thread, LCK_ASSERT_OWNED); in thread_clear_runq_locked()
3824 thread_assert_runq_nonnull(thread); in thread_clear_runq_locked()
3825 thread->__runq.runq = PROCESSOR_NULL; in thread_clear_runq_locked()
3829 thread_assert_runq_null(__assert_only thread_t thread) in thread_assert_runq_null() argument
3831 assert(thread->__runq.runq == PROCESSOR_NULL); in thread_assert_runq_null()
3835 thread_assert_runq_nonnull(thread_t thread) in thread_assert_runq_nonnull() argument
3837 pset_assert_locked(thread->__runq.runq->processor_set); in thread_assert_runq_nonnull()
3838 assert(thread->__runq.runq != PROCESSOR_NULL); in thread_assert_runq_nonnull()
3842 thread_set_honor_qlimit(thread_t thread) in thread_set_honor_qlimit() argument
3844 thread->options |= TH_OPT_HONOR_QLIMIT; in thread_set_honor_qlimit()
3848 thread_clear_honor_qlimit(thread_t thread) in thread_clear_honor_qlimit() argument
3850 thread->options &= (~TH_OPT_HONOR_QLIMIT); in thread_clear_honor_qlimit()
3857 thread_enable_send_importance(thread_t thread, boolean_t enable) in thread_enable_send_importance() argument
3860 thread->options |= TH_OPT_SEND_IMPORTANCE; in thread_enable_send_importance()
3862 thread->options &= ~TH_OPT_SEND_IMPORTANCE; in thread_enable_send_importance()
3867 thread_get_ipc_propagate_attr(thread_t thread, struct thread_attr_for_ipc_propagation *attr) in thread_get_ipc_propagate_attr() argument
3872 if (thread == NULL || attr == NULL) { in thread_get_ipc_propagate_attr()
3876 iotier = proc_get_effective_thread_policy(thread, TASK_POLICY_IO); in thread_get_ipc_propagate_attr()
3877 qos = proc_get_effective_thread_policy(thread, TASK_POLICY_QOS); in thread_get_ipc_propagate_attr()
3880 qos = thread_user_promotion_qos_for_pri(thread->base_pri); in thread_get_ipc_propagate_attr()
3921 thread_get_last_wait_duration(thread_t thread) in thread_get_last_wait_duration() argument
3923 return thread->last_made_runnable_time - thread->last_run_time; in thread_get_last_wait_duration()
3956 thread_t thread; in thread_port_with_flavor_no_senders() local
3967 thread = ipc_kobject_get_locked(port, kotype); in thread_port_with_flavor_no_senders()
3968 if (thread != THREAD_NULL) { in thread_port_with_flavor_no_senders()
3969 thread_reference(thread); in thread_port_with_flavor_no_senders()
3973 if (thread == THREAD_NULL) { in thread_port_with_flavor_no_senders()
3984 thread_mtx_lock(thread); in thread_port_with_flavor_no_senders()
4000 tro = get_thread_ro(thread); in thread_port_with_flavor_no_senders()
4005 thread_mtx_unlock(thread); in thread_port_with_flavor_no_senders()
4006 thread_deallocate(thread); in thread_port_with_flavor_no_senders()
4012 thread_mtx_unlock(thread); in thread_port_with_flavor_no_senders()
4016 thread_deallocate(thread); in thread_port_with_flavor_no_senders()
4082 ctid_table_add(thread_t thread) in ctid_table_add() argument
4086 cid = compact_id_get(&ctid_table, CTID_MAX_THREAD_NUMBER, thread); in ctid_table_add()
4087 thread->ctid = ctid_mangle(cid); in ctid_table_add()
4091 ctid_table_remove(thread_t thread) in ctid_table_remove() argument
4095 value = compact_id_put(&ctid_table, ctid_unmangle(thread->ctid)); in ctid_table_remove()
4096 assert3p(value, ==, thread); in ctid_table_remove()
4097 thread->ctid = 0; in ctid_table_remove()
4112 thread_t thread = THREAD_NULL; in ctid_get_thread() local
4115 thread = *compact_id_resolve(&ctid_table, ctid_unmangle(ctid)); in ctid_get_thread()
4116 assert(thread && thread->ctid == ctid); in ctid_get_thread()
4118 return thread; in ctid_get_thread()
4122 thread_get_ctid(thread_t thread) in thread_get_ctid() argument
4124 return thread->ctid; in thread_get_ctid()
4139 thread_process_signature(thread_t thread, task_t task) in thread_process_signature() argument
4141 return machine_thread_process_signature(thread, task); in thread_process_signature()
4184 dtrace_get_thread_predcache(thread_t thread) in dtrace_get_thread_predcache() argument
4186 if (thread != THREAD_NULL) { in dtrace_get_thread_predcache()
4187 return thread->t_dtrace_predcache; in dtrace_get_thread_predcache()
4194 dtrace_get_thread_vtime(thread_t thread) in dtrace_get_thread_vtime() argument
4196 if (thread != THREAD_NULL) { in dtrace_get_thread_vtime()
4197 return thread->t_dtrace_vtime; in dtrace_get_thread_vtime()
4204 dtrace_get_thread_last_cpu_id(thread_t thread) in dtrace_get_thread_last_cpu_id() argument
4206 if ((thread != THREAD_NULL) && (thread->last_processor != PROCESSOR_NULL)) { in dtrace_get_thread_last_cpu_id()
4207 return thread->last_processor->cpu_id; in dtrace_get_thread_last_cpu_id()
4214 dtrace_get_thread_tracing(thread_t thread) in dtrace_get_thread_tracing() argument
4216 if (thread != THREAD_NULL) { in dtrace_get_thread_tracing()
4217 return thread->t_dtrace_tracing; in dtrace_get_thread_tracing()
4224 dtrace_get_thread_inprobe(thread_t thread) in dtrace_get_thread_inprobe() argument
4226 if (thread != THREAD_NULL) { in dtrace_get_thread_inprobe()
4227 return thread->t_dtrace_inprobe; in dtrace_get_thread_inprobe()
4234 thread_get_kernel_stack(thread_t thread) in thread_get_kernel_stack() argument
4236 if (thread != THREAD_NULL) { in thread_get_kernel_stack()
4237 return thread->kernel_stack; in thread_get_kernel_stack()
4245 kasan_get_thread_data(thread_t thread) in kasan_get_thread_data() argument
4247 return &thread->kasan_data; in kasan_get_thread_data()
4253 kcov_get_thread_data(thread_t thread) in kcov_get_thread_data() argument
4255 return &thread->kcov_data; in kcov_get_thread_data()
4269 kcov_stksz_get_thread_stkbase(thread_t thread) in kcov_stksz_get_thread_stkbase() argument
4271 if (thread != THREAD_NULL) { in kcov_stksz_get_thread_stkbase()
4272 kcov_thread_data_t *data = kcov_get_thread_data(thread); in kcov_stksz_get_thread_stkbase()
4276 return thread->kernel_stack; in kcov_stksz_get_thread_stkbase()
4284 kcov_stksz_get_thread_stksize(thread_t thread) in kcov_stksz_get_thread_stksize() argument
4286 if (thread != THREAD_NULL) { in kcov_stksz_get_thread_stksize()
4294 kcov_stksz_set_thread_stack(thread_t thread, vm_offset_t stack) in kcov_stksz_set_thread_stack() argument
4296 kcov_thread_data_t *data = kcov_get_thread_data(thread); in kcov_stksz_set_thread_stack()
4302 dtrace_calc_thread_recent_vtime(thread_t thread) in dtrace_calc_thread_recent_vtime() argument
4304 if (thread == THREAD_NULL) { in dtrace_calc_thread_recent_vtime()
4314 dtrace_set_thread_predcache(thread_t thread, uint32_t predcache) in dtrace_set_thread_predcache() argument
4316 if (thread != THREAD_NULL) { in dtrace_set_thread_predcache()
4317 thread->t_dtrace_predcache = predcache; in dtrace_set_thread_predcache()
4322 dtrace_set_thread_vtime(thread_t thread, int64_t vtime) in dtrace_set_thread_vtime() argument
4324 if (thread != THREAD_NULL) { in dtrace_set_thread_vtime()
4325 thread->t_dtrace_vtime = vtime; in dtrace_set_thread_vtime()
4330 dtrace_set_thread_tracing(thread_t thread, int64_t accum) in dtrace_set_thread_tracing() argument
4332 if (thread != THREAD_NULL) { in dtrace_set_thread_tracing()
4333 thread->t_dtrace_tracing = accum; in dtrace_set_thread_tracing()
4338 dtrace_set_thread_inprobe(thread_t thread, uint16_t inprobe) in dtrace_set_thread_inprobe() argument
4340 if (thread != THREAD_NULL) { in dtrace_set_thread_inprobe()
4341 thread->t_dtrace_inprobe = inprobe; in dtrace_set_thread_inprobe()
4351 thread_t thread = current_thread(); in dtrace_thread_bootstrap() local
4352 if (thread->t_dtrace_flags & TH_DTRACE_EXECSUCCESS) { in dtrace_thread_bootstrap()
4353 thread->t_dtrace_flags &= ~TH_DTRACE_EXECSUCCESS; in dtrace_thread_bootstrap()
4364 dtrace_thread_didexec(thread_t thread) in dtrace_thread_didexec() argument
4366 thread->t_dtrace_flags |= TH_DTRACE_EXECSUCCESS; in dtrace_thread_didexec()