Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1706302
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] perf/core: Avoid context switch overheads |
| Date | 2017-08-08 12:40 +0200 |
| Message-ID | <uca5z-71u-3@gated-at.bofh.it> (permalink) |
| References | <uc9Cx-6yS-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Aug 08, 2017 at 06:00:45PM +0800, 石祤 wrote: > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 426c2ff..3d86695 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -3180,6 +3180,13 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx, > return; > > perf_ctx_lock(cpuctx, ctx); > + /* > + * We must check ctx->nr_events while holding ctx->lock, such > + * that we serialize against perf_install_in_context(). > + */ > + if (!cpuctx->task_ctx && !ctx->nr_events) > + goto unlock; Do we really need the cpuctx->task_ctx test? I think that task_ctx is 'tight' these days. We never have it set unless there are events scheduled for that context. I even think the cpuctx->task_ctx == ctx test right above here is superfluous these days. That could only happen when the perf_install_in_context() IPI came before perf_event_task_sched_in(), but we removed the arch option to do context switches with IRQs enabled. > + > perf_pmu_disable(ctx->pmu); > /* > * We want to keep the following priority order: > @@ -3193,6 +3200,8 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx, > cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); > perf_event_sched_in(cpuctx, ctx, task); > perf_pmu_enable(ctx->pmu); > + > +unlock: > perf_ctx_unlock(cpuctx, ctx); > } > > -- > 2.8.4.31.g9ed660f >
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2] perf/core: Avoid context switch overheads "石祤" <linxiulei@gmail.com> - 2017-08-08 12:10 +0200
Re: [PATCH v2] perf/core: Avoid context switch overheads Peter Zijlstra <peterz@infradead.org> - 2017-08-08 12:40 +0200
Re: [PATCH v2] perf/core: Avoid context switch overheads 林守磊 <linxiulei@gmail.com> - 2017-08-09 02:30 +0200
csiph-web