Received: by 10.223.185.116 with SMTP id b49csp3342202wrg; Mon, 5 Mar 2018 19:44:00 -0800 (PST) X-Google-Smtp-Source: AG47ELtLrb7/+6G0G/ja2dXq0uMbDKfQ+Nl2RsOWJ1WPLk2Ezcwks4ZSaSDp2Qj+m0CzbBAmCHZA X-Received: by 10.98.141.205 with SMTP id p74mr17476555pfk.211.1520307840250; Mon, 05 Mar 2018 19:44:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520307840; cv=none; d=google.com; s=arc-20160816; b=KdIxnASzpNTRpem9GxN7Mc9Evxhg+d1uWT7HXLF2tMPI7W2x0QUZjksmL+L1tBxrzr 2KqVfLuqxSQm8m/EYA1Gq7/9A7/Xs+k+6Alv2ORuEsLE0ZBkaN5ojuN8+hEHUvsLbaV5 JrXU7vW93g9H/4ejazPCms8tF8SDYRc0JVULcNtRtKIF87T1y30GCHKcNR+gMboqu2nl vyXxdYDdVqLkE2akpT8bGJWgHybkj+QChv6YmqoiXNi9/qu+oCt8rHO+RuvtKNdXYsS8 MkmyUu0+pdxE13EuOpvo6xNOBlnBPAs2yfegr0qdPq/2g0eWM/43XC5mB+li0CZtIYKc FIrw== 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=4CKsZqh8HyhQmwfO7dghhlBlNB8wbiYdCMrAKVTYZZk=; b=TuMe81jLQN3DV/tXY/rYT5kLqI0znQ7WezOqFR7vxPjXjDRMkSlI5b3c4DxYL1U69M VPM06Beo/rdcGnbN6KYYcWNk46m0FOEL7pC0MKGP80pUTmPSojrHirtjXtItCPs0UtMZ YUdoKxiHo+fuQ1MxvmI6yQrS36PzZQ0YZUovDFnhOntp/ypHuiYUeZ8F+Cl8xJYZFFa+ EhvMIFXVYdT6icQuRXzCH/cZEhs/UjKgVrZ3zvQOhxmFY8xjEUS5DYu0fTvdvUD1yaR3 4fNQiYaIK6Ic7O0qM1X5MrD/njZ2nUmQxaXx1YVtzC+SF88AwSSpLvZrcAA3ctD4OTEX 2xRA== 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 r12-v6si10428806plo.359.2018.03.05.19.43.44; Mon, 05 Mar 2018 19:44: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 S1753087AbeCFDmu (ORCPT + 99 others); Mon, 5 Mar 2018 22:42:50 -0500 Received: from mga01.intel.com ([192.55.52.88]:24923 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752586AbeCFDmt (ORCPT ); Mon, 5 Mar 2018 22:42:49 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2018 19:42:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,430,1515484800"; d="scan'208";a="39505531" Received: from gvt-dell.bj.intel.com (HELO intel.com) ([10.238.154.59]) by orsmga002.jf.intel.com with SMTP; 05 Mar 2018 19:42:46 -0800 Date: Tue, 6 Mar 2018 11:33:48 +0800 From: "Du, Changbin" To: Jiri Olsa Cc: "Du, Changbin" , 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: <20180306033348.n5pzjqylej22xcva@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> <20180305071136.qs3lsoh432mzbizw@intel.com> <20180305223754.GB7403@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180305223754.GB7403@krava> 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 I just done final version, please check v2. Thanks for your comments! 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? > > > + 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 -- Thanks, Changbin Du