From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753881AbbGGGqM (ORCPT ); Tue, 7 Jul 2015 02:46:12 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:44336 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753696AbbGGGqH (ORCPT ); Tue, 7 Jul 2015 02:46:07 -0400 Date: Tue, 7 Jul 2015 08:45:58 +0200 From: Peter Zijlstra To: Cong Wang Cc: linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , Cong Wang Subject: Re: [PATCH v2] sched: introduce sched_switch_post trace event Message-ID: <20150707064558.GL3644@twins.programming.kicks-ass.net> References: <1436210145-5520-1-git-send-email-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436210145-5520-1-git-send-email-xiyou.wangcong@gmail.com> 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, Jul 06, 2015 at 12:15:45PM -0700, Cong Wang wrote: > Currently we only have one sched_switch trace event > for task switching, which is generated very early during > task switch. When we try to monitor per-container perf > events, this is not what we expect. > > For example, we have a process A which is in the cgroup > we monitor, and process B which isn't, when kernel switches > from B to A, the sched_switch event is not recorded for this > cgroup since it belongs to B (current process is still B > util we finish the switch), but we require this event to > signal that process A in this cgroup gets scheduled. This is > crucial for calculating schedule latency (like `perf sched`). > > Ideally, we need to split the sched_switch event into two: > sched_in event before we perform the switch, and sched_out > event after we perform the switch. However, for compatibility, > we can not change the sched_switch event. So before we have > trace event alias, we can just reuse sched_switch and introduce > sched_switch_post event instead. No.. its still horrible. You're trying to solve perf problems with ftrace; this cannot work. Does this patch by Adrian work for you? I think it solves this problem and a bunch of others. lkml.kernel.org/r/1435927962-32417-2-git-send-email-adrian.hunter@intel.com