函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:perf_event_context_sched_out

函数原型:static void perf_event_context_sched_out(struct task_struct *task, int ctxn, struct task_struct *next)

返回类型:void

参数:

类型参数名称
struct task_struct *task
intctxn
struct task_struct *next
3204  ctx等于perf_event_ctxp[ctxn]
3208  do_switch等于1
3210  如果此条件成立可能性大(为编译器优化)(!ctx)则返回
3213  cpuctx等于__get_cpu_context(ctx)
3214  如果非task_ctx则返回
3217  _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
3218  next_ctx等于perf_event_ctxp[ctxn]
3219  如果非next_ctx则转到:unlock
3222  parent等于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().(These fields let us detect when two contexts have both* been cloned (inherited) from a common ancestor.)
3223  next_parent等于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().(These fields let us detect when two contexts have both* been cloned (inherited) from a common ancestor.)
3226  如果非parent且非next_parent则转到:unlock
3229  如果next_parent恒等于ctxnext_ctx恒等于parentnext_parent恒等于parent
3239  raw_spin_lock( & Protect the states of the events in the list,* nr_active, and the list:)
3240  raw_spin_lock_nested( & Protect the states of the events in the list,* nr_active, and the list:, For trivial one-depth nesting of a lock-class, the following* global define can be used. (Subsystems with multiple levels* of nesting should define their own lock-nesting subclasses.))
3242  pmu等于pmu
3244  WRITE_ONCE(task, next)
3245  WRITE_ONCE(task, task)
3268  do_switch等于0
3272  raw_spin_unlock( & Protect the states of the events in the list,* nr_active, and the list:)
3273  raw_spin_unlock( & Protect the states of the events in the list,* nr_active, and the list:)
3275  unlock :
3276  _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()
3278  如果do_switch
3279  raw_spin_lock( & Protect the states of the events in the list,* nr_active, and the list:)
3280  task_ctx_sched_out(cpuctx, ctx, EVENT_ALL)
3281  raw_spin_unlock( & Protect the states of the events in the list,* nr_active, and the list:)
调用者
名称描述
__perf_event_task_sched_outCalled from scheduler to remove the events of the current task,* with interrupts disabled