函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Get the perf_event_context for a task and lock it.* This has to cope with with the fact that until it is locked,* the context could get moved to another task.

函数原型:static struct perf_event_context *perf_lock_task_context(struct task_struct *task, int ctxn, unsigned long *flags)

返回类型:struct perf_event_context

参数:

类型参数名称
struct task_struct *task
intctxn
unsigned long *flags
1373  retry :
1383  local_irq_save( * flags)
1384  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1385  ctx等于cu_dereference() - fetch RCU-protected pointer for dereferencing*@p: The pointer to read, prior to dereferencing* This is a simple wrapper around rcu_dereference_check().(perf_event_ctxp[ctxn])
1386  如果ctx
1397  raw_spin_lock( & Protect the states of the events in the list,* nr_active, and the list:)
1402  转到:retry
1408  ctx = NULL
1409  否则
1410  WARN_ON_ONCE(task != task)
1413  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1414  如果非ctxlocal_irq_restore( * flags)
1416  返回:ctx
调用者
名称描述
perf_pin_task_contextGet 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.
find_get_contextReturns a matching context with refcount and pincount.