From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754116AbbJIG2C (ORCPT ); Fri, 9 Oct 2015 02:28:02 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:34307 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753994AbbJIG2A (ORCPT ); Fri, 9 Oct 2015 02:28:00 -0400 Date: Fri, 9 Oct 2015 15:24:02 +0900 From: Namhyung Kim To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , LKML , Frederic Weisbecker , Stephane Eranian , David Ahern , Andi Kleen Subject: Re: [RFC/PATCH 17/38] perf tools: Maintain map groups list in a leader thread Message-ID: <20151009062402.GC1171@danjae.orange-hotspot.com> References: <1443763159-29098-1-git-send-email-namhyung@kernel.org> <1443763159-29098-18-git-send-email-namhyung@kernel.org> <20151008125143.GB14829@krava.landal.opennet> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20151008125143.GB14829@krava.landal.opennet> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 08, 2015 at 02:51:43PM +0200, Jiri Olsa wrote: > On Fri, Oct 02, 2015 at 02:18:58PM +0900, Namhyung Kim wrote: > > SNIP > > > +static int thread__clone_map_groups(struct thread *thread, > > + struct thread *parent); > > + > > int __thread__set_comm(struct thread *thread, const char *str, u64 timestamp, > > bool exec) > > { > > @@ -182,6 +257,40 @@ int __thread__set_comm(struct thread *thread, const char *str, u64 timestamp, > > unwind__flush_access(thread); > > } > > > > + if (exec) { > > + struct machine *machine; > > + > > + BUG_ON(thread->mg == NULL || thread->mg->machine == NULL); > > + > > + machine = thread->mg->machine; > > + > > + if (thread->tid != thread->pid_) { > > + struct map_groups *old = thread->mg; > > + struct thread *leader; > > + > > + leader = machine__findnew_thread(machine, thread->pid_, > > + thread->pid_); > > + > > + /* now it'll be a new leader */ > > + thread->pid_ = thread->tid; > > + > > + thread->mg = map_groups__new(old->machine); > > + if (thread->mg == NULL) > > + return -ENOMEM; > > hum, isn't this leaking thread->mg ? > should we call map_groups__put(old) at the end of block? You're right! Will fix. Thanks, Namhyung