Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Initialize the perf_event context in task_struct

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

Type:int

Parameter:

TypeParameterName
struct task_struct *child
intctxn
12264  parent = current process
12265  inherited_all = 1
12267  ret = 0
12269  If Value is more likely to compile time(!perf_event_ctxp[ctxn]) Then Return 0
12276  parent_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.
12277  If Not parent_ctx Then Return 0
12291  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.)
12298  ret = Creates the child task context and tries to inherit the event-group.* Clears @inherited_all on !attr.inherited or error. Note that we'll leave* inherited_all set when we 'fail' to inherit an orphaned event; this is
12300  If ret Then Go to out_unlock
12309  raw_spin_lock_irqsave( & Protect the states of the events in the list,* nr_active, and the list:, flags)
12310  rotate_disable = 1
12311  raw_spin_unlock_irqrestore( & Protect the states of the events in the list,* nr_active, and the list:, flags)
12314  ret = Creates the child task context and tries to inherit the event-group.* Clears @inherited_all on !attr.inherited or error. Note that we'll leave* inherited_all set when we 'fail' to inherit an orphaned event; this is
12316  If ret Then Go to out_unlock
12320  raw_spin_lock_irqsave( & Protect the states of the events in the list,* nr_active, and the list:, flags)
12321  rotate_disable = 0
12323  child_ctx = perf_event_ctxp[ctxn]
12325  If child_ctx && inherited_all Then
12333  cloned_ctx = These fields let us detect when two contexts have both* been cloned (inherited) from a common ancestor.
12334  If cloned_ctx Then
12337  Else
12341  get_ctx(These fields let us detect when two contexts have both* been cloned (inherited) from a common ancestor.)
12344  raw_spin_unlock_irqrestore( & Protect the states of the events in the list,* nr_active, and the list:, flags)
12345  out_unlock :
12346  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.
12348  perf_unpin_context(parent_ctx)
12349  put_ctx(parent_ctx)
12351  Return ret
Caller
NameDescribe
perf_event_init_taskInitialize the perf_event context in task_struct