diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-04-09 15:17:40 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-28 12:01:09 -0400 |
commit | 075e0b00857e166dcc3e39037a1fc5a90acac709 (patch) | |
tree | 448cc154bde8d50cb43578416467cfe94d8267c5 /kernel/events | |
parent | f506b3dc0ec454a16d40cab9ee5d75435b39dc50 (diff) |
perf: Optimize ctx_sched_out()
Oleg noted that ctx_sched_out() disables the PMU even though it might
not actually do something, avoid needless PMU-disabling.
Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20110409192141.665385503@chello.nl
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/events')
-rw-r--r-- | kernel/events/core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index d863b3c057bb..4d9a1f014286 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -1760,7 +1760,6 @@ static void ctx_sched_out(struct perf_event_context *ctx, | |||
1760 | struct perf_event *event; | 1760 | struct perf_event *event; |
1761 | 1761 | ||
1762 | raw_spin_lock(&ctx->lock); | 1762 | raw_spin_lock(&ctx->lock); |
1763 | perf_pmu_disable(ctx->pmu); | ||
1764 | ctx->is_active = 0; | 1763 | ctx->is_active = 0; |
1765 | if (likely(!ctx->nr_events)) | 1764 | if (likely(!ctx->nr_events)) |
1766 | goto out; | 1765 | goto out; |
@@ -1770,6 +1769,7 @@ static void ctx_sched_out(struct perf_event_context *ctx, | |||
1770 | if (!ctx->nr_active) | 1769 | if (!ctx->nr_active) |
1771 | goto out; | 1770 | goto out; |
1772 | 1771 | ||
1772 | perf_pmu_disable(ctx->pmu); | ||
1773 | if (event_type & EVENT_PINNED) { | 1773 | if (event_type & EVENT_PINNED) { |
1774 | list_for_each_entry(event, &ctx->pinned_groups, group_entry) | 1774 | list_for_each_entry(event, &ctx->pinned_groups, group_entry) |
1775 | group_sched_out(event, cpuctx, ctx); | 1775 | group_sched_out(event, cpuctx, ctx); |
@@ -1779,8 +1779,8 @@ static void ctx_sched_out(struct perf_event_context *ctx, | |||
1779 | list_for_each_entry(event, &ctx->flexible_groups, group_entry) | 1779 | list_for_each_entry(event, &ctx->flexible_groups, group_entry) |
1780 | group_sched_out(event, cpuctx, ctx); | 1780 | group_sched_out(event, cpuctx, ctx); |
1781 | } | 1781 | } |
1782 | out: | ||
1783 | perf_pmu_enable(ctx->pmu); | 1782 | perf_pmu_enable(ctx->pmu); |
1783 | out: | ||
1784 | raw_spin_unlock(&ctx->lock); | 1784 | raw_spin_unlock(&ctx->lock); |
1785 | } | 1785 | } |
1786 | 1786 | ||