Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\events\core.c Create Date:2022-07-28 13:41:18
Last Modify:2022-05-20 07:50:19 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:perf_event_exit_task_context

Proto:static void perf_event_exit_task_context(struct task_struct *child, int ctxn)

Type:void

Parameter:

TypeParameterName
struct task_struct *child
intctxn
11841  struct perf_event_context * child_ctx, * clone_ctx = NULL
11844  WARN_ON_ONCE(child != current process)
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  If Not child_ctx Then Return
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  raw_spin_lock_irq( & 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(current process)
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  If clone_ctx Then put_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)
Caller
NameDescribe
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().