Re: [PATCH 2/7] perf: Generalize task_function_call()ers
From: Alexander Shishkin
Date: Mon Dec 21 2015 - 09:42:02 EST
Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:
> -
> - /*
> - * If the context we're installing events in is not the
> - * active task_ctx, flip them.
> - */
> - if (ctx->task && task_ctx != ctx) {
> - if (task_ctx)
> - raw_spin_unlock(&task_ctx->lock);
> - raw_spin_lock(&ctx->lock);
> - task_ctx = ctx;
> - }
> -
> - if (task_ctx) {
> - cpuctx->task_ctx = task_ctx;
> - task = task_ctx->task;
> - }
> -
So previously, this would schedule in the tast_ctx right in
perf_install_in_context path.
The new code would only reschedule the context if it is already on:
> + if (ctx->is_active)
> + perf_resched_context(cpuctx);
> }
which means, iiuc, that an enabled event (say, attr.disabled==0) will
have to wait till the next time the ctx::task is scheduled instead of
getting scheduled right here.
Something like
if (ctx->task == current && ctx->nr_events)
perf_event_sched_in(cpuctx, ctx, ctx->task);
might make sense here.
Also the new __perf_event_enable() has the same symptom: it doesn't
schedule the new context on, only reschedule it if it's already on.
Regards,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/