From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754694AbbESGeV (ORCPT ); Tue, 19 May 2015 02:34:21 -0400 Received: from lgeamrelo04.lge.com ([156.147.1.127]:54138 "EHLO lgeamrelo04.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753860AbbESGeU (ORCPT ); Tue, 19 May 2015 02:34:20 -0400 X-Original-SENDERIP: 10.177.220.203 X-Original-MAILFROM: namhyung@kernel.org Date: Tue, 19 May 2015 15:24:52 +0900 From: Namhyung Kim To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , LKML , David Ahern , Adrian Hunter , Andi Kleen , Frederic Weisbecker , Stephane Eranian Subject: Re: [PATCH 04/40] perf tools: Create separate mmap for dummy tracking event Message-ID: <20150519062452.GD21663@sejong> References: <1431909055-21442-1-git-send-email-namhyung@kernel.org> <1431909055-21442-5-git-send-email-namhyung@kernel.org> <20150518180713.GA16373@krava.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150518180713.GA16373@krava.redhat.com> 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 Hi Jiri, On Mon, May 18, 2015 at 08:07:13PM +0200, Jiri Olsa wrote: > On Mon, May 18, 2015 at 09:30:19AM +0900, Namhyung Kim wrote: > > SNIP > > > -static int perf_evlist__alloc_mmap(struct perf_evlist *evlist) > > +static int perf_evlist__alloc_mmap(struct perf_evlist *evlist, bool track_mmap) > > { > > evlist->nr_mmaps = cpu_map__nr(evlist->cpus); > > if (cpu_map__empty(evlist->cpus)) > > evlist->nr_mmaps = thread_map__nr(evlist->threads); > > evlist->mmap = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap)); > > - return evlist->mmap != NULL ? 0 : -ENOMEM; > > + if (evlist->mmap == NULL) > > + return -ENOMEM; > > + > > + if (track_mmap) { > > + evlist->track_mmap = calloc(evlist->nr_mmaps, > > + sizeof(struct perf_mmap)); > > + if (evlist->track_mmap == NULL) { > > + zfree(&evlist->mmap); > > + return -ENOMEM; > > + } > > + } > > + return 0; > > } > > > > struct mmap_params { > > - int prot; > > - int mask; > > + int prot; > > + size_t len; > > struct auxtrace_mmap_params auxtrace_mp; > > }; > > > > -static int __perf_evlist__mmap(struct perf_evlist *evlist, int idx, > > +static int __perf_evlist__mmap(struct perf_evlist *evlist __maybe_unused, > > + struct perf_mmap *pmmap, > > struct mmap_params *mp, int fd) > > hum, looks like this patch should be separated to: > > - one that makes __perf_evlist__mmap use perf_mmap directly > and moves auxtrace_mmap__mmap.. > also __perf_evlist__mmap should be renamed (perf_mmap__mmap? ;-) ) > and evlist arg removed, because it's not used.. > > - one that adds dummy tracing events mmapping > > maybe also separate the code that alloc and free evlist->track_mmap > with perf_evlist__mmap_desc stuff, might help the readability.. OK, will do. Thanks, Namhyung