函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\events\core.c Create Date:2022-07-27 15:01:49
Last Modify:2022-05-20 07:50:19 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:perf_event_exit_task_context

函数原型:static void perf_event_exit_task_context(struct task_struct *child, int ctxn)

返回类型:void

参数:

类型参数名称
struct task_struct *child
intctxn
11841  struct perf_event_context * child_ctx, * clone_ctx = NULL
11844  WARN_ON_ONCE(child != 当前进程)
11846  child_ctx等于Get the context for a task and increment its pin_count so it* can't get swapped to another task. This also increments its* reference count so that the context can't get freed.
11847  如果非child_ctx则返回
11860  mutex_lock( & Protect the list of events. Locking either mutex or lock* is sufficient to ensure the list doesn't change; to change* the list you need to lock both the mutex and the spinlock.)
11867  关闭本地中断,获取所要保护的运行队列(runqueue)的自旋锁(spinlock),为查找可运行进程做准备。( & Protect the states of the events in the list,* nr_active, and the list:)
11868  task_ctx_sched_out(__get_cpu_context(child_ctx), child_ctx, EVENT_ALL)
11874  RCU_INIT_POINTER() - initialize an RCU protected pointer*@p: The pointer to be initialized.*@v: The value to initialized the pointer to.* Initialize an RCU-protected pointer in special cases where readers(perf_event_ctxp[ctxn], NULL)
11875  put_ctx(child_ctx)
11876  WRITE_ONCE(task, TASK_TOMBSTONE)
11877  put_task_struct(当前进程)
11879  clone_ctx等于This must be done under the ctx->lock, such as to serialize against* context_equiv(), therefore we cannot call put_ctx() since that might end up* calling scheduler related locks and ctx->lock nests inside those.
11880  raw_spin_unlock_irq( & Protect the states of the events in the list,* nr_active, and the list:)
11882  如果clone_ctxput_ctx(clone_ctx)
11890  perf_event_task(child, child_ctx, 0)
11892  list_for_each_entry_safe - iterate over list of given type safe against removal of list entry*@pos: the type * to use as a loop cursor.*@n: another type * to use as temporary storage*@head: the head for your list.(child_event, next, & event_list, event_entry)
11893  perf_event_exit_event(child_event, child_ctx, child)
11895  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
11897  put_ctx(child_ctx)
调用者
名称描述
perf_event_exit_taskWhen a child task exits, feed back event values to parent events.* Can be called with cred_guard_mutex held when called from* install_exec_creds().