Re: [tip:perfcounters/core] perf_counter: Optimize context switch between identical inherited contexts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* tip-bot for Paul Mackerras <paulus@xxxxxxxxx> wrote:

> @@ -885,6 +934,16 @@ void perf_counter_task_sched_out(struct task_struct *task, int cpu)
>  
>  	regs = task_pt_regs(task);
>  	perf_swcounter_event(PERF_COUNT_CONTEXT_SWITCHES, 1, 1, regs, 0);
> +
> +	next_ctx = next->perf_counter_ctxp;
> +	if (next_ctx && context_equiv(ctx, next_ctx)) {
> +		task->perf_counter_ctxp = next_ctx;
> +		next->perf_counter_ctxp = ctx;
> +		ctx->task = next;
> +		next_ctx->task = task;
> +		return;
> +	}

there's one complication that this trick is causing - the migration 
counter relies on ctx->task to get per task migration stats:

 static inline u64 get_cpu_migrations(struct perf_counter *counter)
 {
        struct task_struct *curr = counter->ctx->task;

        if (curr)
                return curr->se.nr_migrations;
        return cpu_nr_migrations(smp_processor_id());
 }

as ctx->task is now jumping (while we keep the context), the 
migration stats are out of whack.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux