Function report |
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 activity | Download SCCT | Chinese |
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:
| Type | Parameter | Name |
|---|---|---|
| struct task_struct * | child | |
| int | ctxn |
| 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.) |
| 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) |
| 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 |
| 12335 | These fields let us detect when two contexts have both* been cloned (inherited) from a common ancestor. = cloned_ctx |
| 12336 | parent_gen = parent_gen |
| 12337 | Else |
| 12344 | raw_spin_unlock_irqrestore( & Protect the states of the events in the list,* nr_active, and the list:, flags) |
| 12345 | out_unlock : |
| 12348 | perf_unpin_context(parent_ctx) |
| 12349 | put_ctx(parent_ctx) |
| 12351 | Return ret |
| Name | Describe |
|---|---|
| perf_event_init_task | Initialize the perf_event context in task_struct |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |