From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758789AbbGHUm6 (ORCPT ); Wed, 8 Jul 2015 16:42:58 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:34151 "EHLO mail-ob0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755529AbbGHUmv (ORCPT ); Wed, 8 Jul 2015 16:42:51 -0400 MIME-Version: 1.0 In-Reply-To: <20150706201529.13e1555f@gandalf.local.home> References: <1436210145-5520-1-git-send-email-xiyou.wangcong@gmail.com> <20150706201529.13e1555f@gandalf.local.home> Date: Wed, 8 Jul 2015 13:42:50 -0700 Message-ID: Subject: Re: [PATCH v2] sched: introduce sched_switch_post trace event From: Cong Wang To: Steven Rostedt Cc: LKML , Ingo Molnar , Peter Zijlstra , Cong Wang Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 6, 2015 at 5:15 PM, Steven Rostedt wrote: > On Mon, 6 Jul 2015 12:15:45 -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`). > > I just want to understand this correctly. Does perf sched only listen > to events that are executed by the task in a particular cgroup? There's > no way to say "check sched_switch field next"? > perf_event cgroup needs to be specified in cmdline and `perf sched` doesn't support that currently, I wrote my own tool to do this. (I have some patch to add it to `perf sched`) As I replied in the previous thread, we can certainly check if a process belongs to a cgroup by tracking the PID's, but that is not easy. > > This looks identical to trace_sched_switch. Please convert both to a > DECLARE_EVENT_CLASS() and DEFINE_EVENT()s. > Not identical, I rename 'next' to 'curr' since switch is done 'next' becomes meaningless. Thanks.