函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Inherit an event from parent task to child task.* Returns:* - valid pointer on success* - NULL for orphaned events* - IS_ERR() on error

函数原型:static struct perf_event *inherit_event(struct perf_event *parent_event, struct task_struct *parent, struct perf_event_context *parent_ctx, struct task_struct *child, struct perf_event *group_leader, struct perf_event_context *child_ctx)

返回类型:struct perf_event

参数:

类型参数名称
struct perf_event *parent_event
struct task_struct *parent
struct perf_event_context *parent_ctx
struct task_struct *child
struct perf_event *group_leader
struct perf_event_context *child_ctx
12067  parent_state等于state
12077  如果parentparent_event等于parent
12080  child_event等于Allocate and initialize an event structure
12085  如果是错误则返回:child_event
12089  如果attach_state按位与PERF_ATTACH_TASK_DATA且非pmu specific data
12091  pmu等于pmu
12093  pmu specific data 等于分配内存并置零
12095  如果非pmu specific data
12097  返回:错误号
12107  mutex_lock( & child_mutex)
12108  如果is_orphaned_event(parent_event)或非atomic_long_inc_not_zero( & refcount)则
12110  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.
12112  Used to free events which have a known refcount of 1, such as in error paths* where the event isn't exposed yet and inherited events.
12113  返回:NULL
12116  get_ctx(child_ctx)
12123  如果parent_state大于等于PERF_EVENT_STATE_INACTIVEstate等于PERF_EVENT_STATE_INACTIVE
12125  否则state等于PERF_EVENT_STATE_OFF
12128  如果freq
12129  sample_period等于sample_period
12130  hwc等于hw
12132  sample_period等于sample_period
12133  last_period等于sample_period
12135  local64_set( & period_left, sample_period)
12138  ctx等于child_ctx
12139  overflow_handler等于overflow_handler
12140  overflow_handler_context等于overflow_handler_context
12146  Called at perf_event creation and when events are attached/detached from a* group.
12147  perf_event__id_header_size(child_event)
12152  raw_spin_lock_irqsave( & Protect the states of the events in the list,* nr_active, and the list:, flags)
12153  add_event_to_ctx(child_event, child_ctx)
12154  raw_spin_unlock_irqrestore( & Protect the states of the events in the list,* nr_active, and the list:, flags)
12159  添加链表项
12160  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.
12162  返回:child_event
调用者
名称描述
inherit_groupInherits an event group.* This will quietly suppress orphaned events; !inherit_event() is not an error.* This matches with perf_event_release_kernel() removing all child events.* Returns:* - 0 on success* - <0 on error