From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756218AbaCRQO3 (ORCPT ); Tue, 18 Mar 2014 12:14:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57248 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753543AbaCRQO2 (ORCPT ); Tue, 18 Mar 2014 12:14:28 -0400 Date: Tue, 18 Mar 2014 14:31:31 +0100 From: Jiri Olsa To: Namhyung Kim Cc: linux-kernel@vger.kernel.org, Don Zickus , Corey Ashford , David Ahern , Frederic Weisbecker , Ingo Molnar , Paul Mackerras , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: Re: [PATCH 3/5] perf tools: Allocate thread map_groups dynamicaly Message-ID: <20140318133131.GB7845@krava.brq.redhat.com> References: <1394805606-25883-1-git-send-email-jolsa@redhat.com> <1394805606-25883-4-git-send-email-jolsa@redhat.com> <87d2hlthzi.fsf@sejong.aot.lge.com> <20140317145259.GD6469@krava.brq.redhat.com> <87lhw8rnsi.fsf@sejong.aot.lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lhw8rnsi.fsf@sejong.aot.lge.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 18, 2014 at 04:03:41PM +0900, Namhyung Kim wrote: > Hi Jiri, > > On Mon, 17 Mar 2014 15:52:59 +0100, Jiri Olsa wrote: > > On Mon, Mar 17, 2014 at 04:13:53PM +0900, Namhyung Kim wrote: > >> On Fri, 14 Mar 2014 15:00:04 +0100, Jiri Olsa wrote: > >> > Moving towards sharing map groups within a process threads. > >> > > >> > Because of this we need the map groups to be dynamically > >> > allocated. No other functional change is intended in here. > >> > @@ -664,7 +664,7 @@ void thread__find_addr_map(struct thread *thread, > >> > al->cpumode = cpumode; > >> > al->filtered = false; > >> > > >> > - if (machine == NULL) { > >> > + if ((machine == NULL) || (mg == NULL)) { > >> > al->map = NULL; > >> > return; > >> > } > >> > >> What about the kernel threads? I guess they're not using thread->mg but > >> machine->kmaps instead? > > > > The machine->kmaps is used to store kernel maps - core + modules. > > > > All threads (including kernel ones) are using thread->mg, > > kernel threads have empty /proc/x/maps file. > > > > In case the sample address is detected within kernel space, > > the machine->kmaps is used instead of thread->mg: > > That means kernel threads don't need to allocate ->mg, right? So I'd > suggest checking cpumode first and then allocate ->mg for userspace maps > only. good idea, will do thanks, jirka