lkml.org 
[lkml]   [2014]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/5] perf tools: Share process map groups within process threads
On Mon, Mar 17, 2014 at 04:25:15PM +0900, Namhyung Kim wrote:
> On Fri, 14 Mar 2014 15:00:06 +0100, Jiri Olsa wrote:
> > + if (!mg) {
> > + struct thread *leader = thread__get_leader(thread);
> > +
> > + if (!leader)
> > + return NULL;
> > +
> > + if (leader->mg)
> > + mg = leader->mg;
> > + else
> > + mg = thread__map_groups_alloc(leader);
> > +
> > + if (leader != thread)
> > + thread->mg = mg;
> > +
> > + mg->refcnt++;
>
> What's the value of mg->refcnt here in case of leader != thread and
> leader->mg was not allocated originally? I think it's 1 - but shouldn't
> it be 2 since it's referenced from both of leader and the thread now?

right you are..

I need to initialize refcnt to 1 in thread__map_groups_alloc
and increase it only for the '(leader != thread)' case

I'll add some test for this

thanks,
jirka


\
 
 \ /
  Last update: 2014-03-17 12:41    [W:0.156 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site