From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751547AbbLUOl7 (ORCPT ); Mon, 21 Dec 2015 09:41:59 -0500 Received: from mga01.intel.com ([192.55.52.88]:42562 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751049AbbLUOl6 (ORCPT ); Mon, 21 Dec 2015 09:41:58 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,459,1444719600"; d="scan'208";a="876002108" From: Alexander Shishkin To: Peter Zijlstra Cc: Ingo Molnar , linux-kernel@vger.kernel.org, vince@deater.net, eranian@google.com, johannes@sipsolutions.net, Arnaldo Carvalho de Melo Subject: Re: [PATCH 2/7] perf: Generalize task_function_call()ers In-Reply-To: <20151218090129.GQ6373@twins.programming.kicks-ass.net> References: <1449138762-15194-1-git-send-email-alexander.shishkin@linux.intel.com> <1449138762-15194-3-git-send-email-alexander.shishkin@linux.intel.com> <20151203173431.GC3816@twins.programming.kicks-ass.net> <87vb88yjs6.fsf@ashishki-desk.ger.corp.intel.com> <20151208165700.GE6357@twins.programming.kicks-ass.net> <20151217134034.GM6373@twins.programming.kicks-ass.net> <87k2odb19x.fsf@ashishki-desk.ger.corp.intel.com> <20151217150732.GG6344@twins.programming.kicks-ass.net> <20151218090129.GQ6373@twins.programming.kicks-ass.net> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 21 Dec 2015 16:39:22 +0200 Message-ID: <87a8p3c1d1.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra 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