From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751823AbbETAHn (ORCPT ); Tue, 19 May 2015 20:07:43 -0400 Received: from lgeamrelo02.lge.com ([156.147.1.126]:60042 "EHLO lgeamrelo02.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbbETAHl (ORCPT ); Tue, 19 May 2015 20:07:41 -0400 X-Original-SENDERIP: 10.177.220.203 X-Original-MAILFROM: namhyung@kernel.org Date: Wed, 20 May 2015 08:58:13 +0900 From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Adrian Hunter , Andi Kleen , Frederic Weisbecker , Stephane Eranian Subject: Re: [PATCH 33/40] perf session: Separate struct machines from session Message-ID: <20150519235813.GB22713@sejong> References: <1431909055-21442-1-git-send-email-namhyung@kernel.org> <1431909055-21442-34-git-send-email-namhyung@kernel.org> <20150518125259.GE15972@kernel.org> <20150519072815.GL21663@sejong> <20150519224618.GC26111@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150519224618.GC26111@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 19, 2015 at 07:46:18PM -0300, Arnaldo Carvalho de Melo wrote: > Em Tue, May 19, 2015 at 04:28:15PM +0900, Namhyung Kim escreveu: > > On Mon, May 18, 2015 at 09:52:59AM -0300, Arnaldo Carvalho de Melo wrote: > > > Em Mon, May 18, 2015 at 09:30:48AM +0900, Namhyung Kim escreveu: > > > > With multi-thread report, separate sessions can be passed to each > > > > thread, in this case we should keep a single machine state for all > > > > struct sessions. Separate machines and have a pointer in sessions. > > > > > > I had to look at all the patch to semi-figure this out, i.e. you said it > > > should be separated from 'perf_session', agreed. > > > > > > But who will create it? How will it be passed to the perf_session > > > instances? > > > > > > Most of the patch is making session->machines be turned into a pointer, > > > but the meat, i.e. who creates it, is unclear, I see a malloc in > > > perf_session__new(), where I was kinda expecting that a higer layer, > > > perhaps in struct tool? Would create the list of all machines (struct > > > machines) and then pass it to multiple perf_session__new() calls. > > > > > > But then perf_session__delete() calls 'free(session->machines)', huh? > > > > OK. So, this is what I have in my head: > > > > perf_tool__create_machines(tool) { > > tool->machines = malloc(); > > machines__init(tool->machines); > > } > > > Probably, but then in this case you would call machines__new(), that > does the malloc and init. > > > > > perf_session__new(file, repipe, tool) { > > session->machines = tool->machines; > > ... > > } > > That could be ok. > > > > > perf_tool__delete_machines(tool) { > > /* call machines-related destructors */ > > free(tool->machines); > > } > > That would be machines__delete(tool->machines), that calls > machine__exit() and then does the free. Right. I'll change it this way. Thanks, Namhyung