From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754667AbbERSIS (ORCPT ); Mon, 18 May 2015 14:08:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60672 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752638AbbERSIA (ORCPT ); Mon, 18 May 2015 14:08:00 -0400 Date: Mon, 18 May 2015 20:07:13 +0200 From: Jiri Olsa To: Namhyung Kim 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: <20150518180713.GA16373@krava.redhat.com> References: <1431909055-21442-1-git-send-email-namhyung@kernel.org> <1431909055-21442-5-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1431909055-21442-5-git-send-email-namhyung@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 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.. jirka