Received: by 10.223.185.116 with SMTP id b49csp3152586wrg; Mon, 5 Mar 2018 15:18:00 -0800 (PST) X-Google-Smtp-Source: AG47ELupJ06O1IXIRNFi5TQtdR5W5RNNyhG+JYhDsjkUubpPGpy/kUVWc83zWJIp6WZyljEiIdDE X-Received: by 10.99.109.79 with SMTP id i76mr12997177pgc.402.1520291880457; Mon, 05 Mar 2018 15:18:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520291880; cv=none; d=google.com; s=arc-20160816; b=0TDxWUM3ew0vKZBxU9eOlVWdTmOmhdaOb96bRJEUqGrxeAEctPcQQe4qGhheOUXxtS +4wrPUs+MnhauzweNg/taWAzbmjey+jNxEkTsKTayGzAeC7pBPmGiLkbeZPbvgB2BzhU /uVeC/1RygWvtHbJSdIaDRVkzr7v9/650dE5Z5mfJIxTJBs843XpLd4ebeA/ux7NYeCH tEEChIvTJkvrDPIGYWeARrz4s+7r9K2oZpcjQunL00iSFLQD3RuWRzr1c1RDQyLimxjd 17uOp6uiAafA9DTAdZNoxZIWPZa2B2mqX1U6ostGBCzrZfwL/K7nq6T8oN5LbQrSuIFk Muag== 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=CNPm7fcfT1z1GCCkeIhZmpDdqFuOstssSWYePHK58cU=; b=UM0EJeoacMhCjU2dR+90JqMUtMFTdCUWDOpQG57wKqxNNVwCS6Ncg1BnZnm1j/fGfs /1w7c1mUYEokZq7Gj4YemaWzQIrVT/NYyaB25YaRIfG1HnxnojrVgrq6hM1yLkF7keCh bnBBJDuE5QN82ZEY+Lieq13cP3EQUlB+TaP5D5RXOqAdC2q1RrYoPFj1/otF3xghgZah ZzWlgeNzgkSuslPiunnTR13ZRrtd0V7R5UfVizuiPskFKzPu0jbo5vJiU59NSqAv1zoA 65n1/P6aF0MbS6mHO0V8HWUvCXpg+cy2psylpMvlM7Pm4Lu3Skw/dOJCQlTBumhbazwm 6DoA== 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 n3si8988990pgc.12.2018.03.05.15.17.46; Mon, 05 Mar 2018 15:18:00 -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 S932731AbeCEXQE (ORCPT + 99 others); Mon, 5 Mar 2018 18:16:04 -0500 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:33161 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752936AbeCEXQD (ORCPT ); Mon, 5 Mar 2018 18:16:03 -0500 Received: from unknown (HELO lgeamrelo01.lge.com) (156.147.1.125) by 156.147.23.53 with ESMTP; 6 Mar 2018 08:16:01 +0900 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: namhyung@kernel.org Received: from unknown (HELO sejong) (10.177.227.17) by 156.147.1.125 with ESMTP; 6 Mar 2018 08:16:01 +0900 X-Original-SENDERIP: 10.177.227.17 X-Original-MAILFROM: namhyung@kernel.org Date: Tue, 6 Mar 2018 08:16:00 +0900 From: Namhyung Kim To: Jiri Olsa Cc: "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: <20180305231600.GB8824@sejong> References: <1519386040-25874-1-git-send-email-changbin.du@intel.com> <20180302105254.234axj7b3nixakav@intel.com> <20180302113845.GC16348@krava> <20180302144732.GA2471@danjae.aot.lge.com> <20180305071136.qs3lsoh432mzbizw@intel.com> <20180305223754.GB7403@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180305223754.GB7403@krava> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, Mar 05, 2018 at 11:37:54PM +0100, Jiri Olsa wrote: > On Mon, Mar 05, 2018 at 03:11:36PM +0800, Du, Changbin wrote: > > SNIP > > > > > 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); > > should you use machine__find_thread in here? Yep, perf_event__process_comm() already created a new thread if needed. And the return value of it should be checked. > > > + if (thread) { > > + r = thread__priv(thread); > > + if (r) > > + r->comm_changed = true; > > + thread__put(thread); > > + } Missing return. > > +} > > + > > 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. > > they can both go to struct thread_runtime then Agreed. > > > > > So I still prefer my privous simpler change. Thanks! > > I was wrong thinking that the amount of code > making it sched specific would be biger > > we're trying to keep the core structs generic, > so this one fits better Right. Thanks, Namhyung