Received: by 10.223.185.116 with SMTP id b49csp2291521wrg; Sun, 4 Mar 2018 23:37:23 -0800 (PST) X-Google-Smtp-Source: AG47ELvE4md5vY4vTZ2O72XCSaMnbYTdCNMY4FVfstAygHvxx0Tm9PRzlBBl7VwpvwBYFYuMlNIf X-Received: by 10.101.101.138 with SMTP id u10mr11229877pgv.299.1520235443745; Sun, 04 Mar 2018 23:37:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520235443; cv=none; d=google.com; s=arc-20160816; b=wQzLTtpYrP7OF2/gXDWCXhv3nubKR69aSDyKtnL6ZaMxnXicZ3cxdnv94nHTUPGvKk BPJJqPOj29CjjAsHXtelRqlWIRDmqaJiRtXZapgM4VVX/hUCkR1wWcS2s4bf76ULfXxf 1Htbml6CRJb273WmrUXuaAyiU5q2PylhR9T0Z6BbSzKbH7wFt4Zht5vhHnXMjOrG5Ey9 GodXXXzTJzwqNnKWwa/dibTc7EgaUuTc3Hk1/1EPMeY2gEXNY5QrsUlgdmQ7rZ2MnT51 yBv+P/8dlH+UYahwWYEewMMyTCL6HGsNbaljXpYSVg/YZo1pprwLJMgIh1qDFF+vVwiB ddjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Jmw0rRqA+K+ybYEyAdDTpPnatogS60wP7a+UvLoTmHo=; b=xZm3WEof/hr6/LoldEXXqCMCuC410exWovnxgtTI+SAkwdggslGqkOYL5sGD5bE50u e8eTt5ZgIRBQ40uPZIO0Z8NSsi5G+VhKHfzpF3MNQokIlN0ShHjkdVdnq3wdkFIWD3ZX GUCRV2oIFmnk4tLMGHEszzMOfVzqRHP+8vjYVdT7WjZA1Z+O3qW7ls7BiCIFOm47M1wf 8QIGAqld8TxDZk/IXEMOG72NJnqP6ts4ArPzI6hLH+AdMY06UhjNRd+OyrSsfHOVXpUe O271zv4T2Yu9SQcSQ7Ck/21psl7MXyiQgkHEn4tdnYgHEw8XaJTtyElagv7tuPXlhFW3 wpzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j91-v6si10171pld.202.2018.03.04.23.37.09; Sun, 04 Mar 2018 23:37:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933055AbeCEHUj (ORCPT + 99 others); Mon, 5 Mar 2018 02:20:39 -0500 Received: from mga06.intel.com ([134.134.136.31]:57769 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932679AbeCEHUh (ORCPT ); Mon, 5 Mar 2018 02:20:37 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2018 23:20:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,426,1515484800"; d="scan'208";a="22030670" Received: from gvt-dell.bj.intel.com (HELO intel.com) ([10.238.154.59]) by fmsmga008.fm.intel.com with SMTP; 04 Mar 2018 23:20:34 -0800 Date: Mon, 5 Mar 2018 15:11:36 +0800 From: "Du, Changbin" To: Namhyung Kim Cc: Jiri Olsa , "Du, Changbin" , acme@kernel.org, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, kernel-team@lge.com Subject: Re: [RESEND PATCH] perf sched map: re-annotate shortname if thread comm changed Message-ID: <20180305071136.qs3lsoh432mzbizw@intel.com> References: <1519386040-25874-1-git-send-email-changbin.du@intel.com> <20180302105254.234axj7b3nixakav@intel.com> <20180302113845.GC16348@krava> <20180302144732.GA2471@danjae.aot.lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180302144732.GA2471@danjae.aot.lge.com> User-Agent: NeoMutt/20171027-42-ad8712 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Mar 02, 2018 at 11:47:32PM +0900, Namhyung Kim wrote: > Hi, > > On Fri, Mar 02, 2018 at 12:38:45PM +0100, Jiri Olsa wrote: > > On Fri, Mar 02, 2018 at 06:52:54PM +0800, Du, Changbin wrote: > > > Hello, any comment? > > > > sry, overlooked this one > > > > SNIP > > > > > > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c > > > > index 68b65b1..c660fe6 100644 > > > > --- a/tools/perf/util/thread.c > > > > +++ b/tools/perf/util/thread.c > > > > @@ -212,6 +212,7 @@ static int ____thread__set_comm(struct thread *thread, const char *str, > > > > unwind__flush_access(thread); > > > > } > > > > > > > > + thread->comm_changed = true; > > > > thread->comm_set = true; > > > > > > > > return 0; > > > > diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h > > > > index 40cfa36..b9a328b 100644 > > > > --- a/tools/perf/util/thread.h > > > > +++ b/tools/perf/util/thread.h > > > > @@ -27,6 +27,7 @@ struct thread { > > > > int cpu; > > > > refcount_t refcnt; > > > > char shortname[3]; > > > > + bool comm_changed; > > > > I don't like that it's in struct thread and set by generic function, > > and just one command (sched) checks/sets it back.. I'd rather see it > > in thread::priv area.. > > 100% agreed. > > > > on the other hand it's simple enough and looks > > like generic solution would be more tricky > > What about adding perf_sched__process_comm() to set it in the > thread::priv? > I can be done, then thread->comm_changed moves to thread_runtime->comm_changed. Draft code as below. It is also a little tricky. +int perf_sched__process_comm(struct perf_tool *tool __maybe_unused, + union perf_event *event, + struct perf_sample *sample, + struct machine *machine) +{ + struct thread *thread; + struct thread_runtime *r; + + perf_event__process_comm(tool, event, sample, machine); + + thread = machine__findnew_thread(machine, pid, tid); + if (thread) { + r = thread__priv(thread); + if (r) + r->comm_changed = true; + thread__put(thread); + } +} + static int perf_sched__read_events(struct perf_sched *sched) { const struct perf_evsel_str_handler handlers[] = { @@ -3291,7 +3311,7 @@ int cmd_sched(int argc, const char **argv) struct perf_sched sched = { .tool = { .sample = perf_sched__process_tracepoint_sample, - .comm = perf_event__process_comm, + .comm = perf_sched__process_comm, But I'd keep 'comm_changed' where 'shortname' is defined. I think they should appears togother. And 'shortname' is only used by sched command, too. So I still prefer my privous simpler change. Thanks! > Thanks, > Namhyung -- Thanks, Changbin Du