函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Initialize the perf_event context in task_struct

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

返回类型:int

参数:

类型参数名称
struct task_struct *child
intctxn
12264  parent等于当前进程
12265  inherited_all等于1
12267  ret等于0
12269  如果此条件成立可能性大(为编译器优化)(!perf_event_ctxp[ctxn])则返回: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  如果非parent_ctx则返回: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  如果ret则转到: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  如果ret则转到: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  如果child_ctxinherited_all
12333  cloned_ctx等于These fields let us detect when two contexts have both* been cloned (inherited) from a common ancestor.
12334  如果cloned_ctx
12336  parent_gen等于parent_gen
12337  否则
12339  parent_gen等于generation
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  返回:ret
调用者
名称描述
perf_event_init_task进程性能调优