Received: by 10.223.185.116 with SMTP id b49csp3122478wrg; Mon, 5 Mar 2018 14:39:36 -0800 (PST) X-Google-Smtp-Source: AG47ELv/KsKPjeQf5342dVatWUMXdB+B7snD24VSjUv52NEzpMdIZ1YI+LpaxX8rqFUhcanA+oYP X-Received: by 2002:a17:902:e65:: with SMTP id 92-v6mr14573037plw.268.1520289576415; Mon, 05 Mar 2018 14:39:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520289576; cv=none; d=google.com; s=arc-20160816; b=YlcbcYt34aWS8BuN4Uxq+X3qhnlX5HMz2X5AUtLF6W8kb2mXHBia4WU6e0OlOiTPj4 wB1Jzen9aBN98M85KdhVMApeen7gfnnpyCVpzZNAojkLJtH5SEXmUyIp9q12C57EVoo1 70lI7Zt9DGxX4cI9UHAvWYgCgQA478eG7lcmDMSzMdvPs5JCYH9OcdU4xhtK0jW17fC+ ml+gI17ZGXhnm7F4t6pyxmRRhPc3HpZda2GnbDpyuCDkwqKnsx1K50qunLCsHuOCzBs0 na0d49K6u8mK/Cy/14Ts+6GMlGRhnmmPHh2qECDv+xySRRR54tMa+uLb5NojBAd5K/yN /CQA== 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=MYO3iPFjk539q8IKsSvqQTHFaeeo+HHcwhW9kWp5qPs=; b=fa1mZjkZ+lqyRo8uzKIhg/HMHgofZ52wYRk9i+tDMp8/f7eB/PUtCHCIPFokrbanSE vwKQs1k1Dd1M/Ejmb/c3O7r0ioldy4+BFjXLiGhTnO6xoAAHeCNR9ER6QJkobe9x8d1L 8WbPG983yQht1JLb9qdwmyXU5FJkmljRAkXy596kzsxS1GYOgWeN4ITxHUoKlyNOGfJs 9mA53jDOTLd/kKVIyGxbDKBBopwDHt8V52iypdDOF6vRj+Uvdjnrox39mr/AWBHgV7HK Fo6HvndprFHAT1/t0BH7jMxkqn2tLwDqBEHzl/fAKb/crk6Kz7tM4E+ZKJdrQ6hwil59 JHFQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13-v6si9940519plq.793.2018.03.05.14.39.22; Mon, 05 Mar 2018 14:39:36 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753187AbeCEWiA (ORCPT + 99 others); Mon, 5 Mar 2018 17:38:00 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54338 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753088AbeCEWh7 (ORCPT ); Mon, 5 Mar 2018 17:37:59 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 955DA8182D1E; Mon, 5 Mar 2018 22:37:58 +0000 (UTC) Received: from krava (ovpn-204-91.brq.redhat.com [10.40.204.91]) by smtp.corp.redhat.com (Postfix) with SMTP id 8FF63111E3EA; Mon, 5 Mar 2018 22:37:55 +0000 (UTC) Date: Mon, 5 Mar 2018 23:37:54 +0100 From: Jiri Olsa To: "Du, Changbin" Cc: Namhyung Kim , 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: <20180305223754.GB7403@krava> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180305071136.qs3lsoh432mzbizw@intel.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 05 Mar 2018 22:37:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 05 Mar 2018 22:37:58 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > + 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. they can both go to struct thread_runtime then > > 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 thanks, jirka