Messages in this thread - First message in thread
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
- "Yan, Zheng"
Patch in this message | | | From | "Yan, Zheng" <> | Subject | [PATCH 05/15] perf, core: Optimize context switch callback invoking | Date | Wed, 11 Dec 2013 15:10:50 +0800 |
| |
From: "Yan, Zheng" <zheng.z.yan@intel.com>
So far only CPU pmu uses context switch callback and it is the first registered pmu. So we can avoid iterating the whole pmu list.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> --- kernel/events/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c index fc97ed6..c281265 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -2373,6 +2373,10 @@ static void perf_pmu_sched_task(struct task_struct *prev, perf_pmu_enable(pmu); perf_ctx_unlock(cpuctx, cpuctx->task_ctx); + + /* so far only CPU pmu uses context switch callback */ + if (++count >= __get_cpu_var(perf_sched_cb_usages)) + break; } rcu_read_unlock(); @@ -6492,7 +6496,7 @@ got_cpu_context: if (!pmu->event_idx) pmu->event_idx = perf_event_idx_default; - list_add_rcu(&pmu->entry, &pmus); + list_add_tail_rcu(&pmu->entry, &pmus); ret = 0; unlock: mutex_unlock(&pmus_lock); -- 1.8.1.4
| |