From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760668AbcAKWDU (ORCPT ); Mon, 11 Jan 2016 17:03:20 -0500 Received: from casper.infradead.org ([85.118.1.10]:41119 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752064AbcAKWDT (ORCPT ); Mon, 11 Jan 2016 17:03:19 -0500 Date: Mon, 11 Jan 2016 23:03:15 +0100 From: Peter Zijlstra To: Stephane Eranian Cc: Ingo Molnar , Alexander Shishkin , LKML , Vince Weaver , Dmitry Vyukov , Andi Kleen , Jiri Olsa Subject: Re: [RFC][PATCH 02/12] perf: Fix cgroup event scheduling Message-ID: <20160111220315.GI6344@twins.programming.kicks-ass.net> References: <20160111162458.427203780@infradead.org> <20160111163228.728460494@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 11, 2016 at 11:43:40AM -0800, Stephane Eranian wrote: > Peter, > > On Mon, Jan 11, 2016 at 8:25 AM, Peter Zijlstra wrote: > > There appears to be a problemin __perf_event_task_sched_in() wrt > > cgroup event scheduling. > > > > The normal event scheduling order is: > > > > CPU pinned > > Task pinned > > CPU flexible > > Task flexible > > > > And since perf_cgroup_sched*() only schedules the cpu context, we must > > call this _before_ adding the task events. > > > I understand this but I am trying to understand why cgroup system-wide event > would be treated differently from regular system-wide events w.r.t. task events > here. This patch is about making cgroup events behave similarly to regular system-wide events. > If I do a cgroup flexible and a task pinned, what happens? Look at perf_event_context_sched_in(), it will first remove the cpu-flexible and then install everything: cpu-pinned (skipped, because that would still be present) task-pinned (new) cpu-flexible (re-issue, possibly truncated due to the new pinned events) task-flexible (new)