lkml.org 
[lkml]   [2014]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] perf tools: Reference count map_groups objects
On Mon, Apr 14, 2014 at 11:22:02AM -0600, David Ahern wrote:
> On 4/14/14, 9:52 AM, Jiri Olsa wrote:

SNIP

> >
> >+void map_groups__put(struct map_groups *mg)
> >+{
> >+ if (--mg->refcnt == 0)
> >+ map_groups__delete(mg);
> >+}
> >+
> > void map_groups__flush(struct map_groups *mg)
> > {
> > int type;
> >diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
> >index 1073e2d..d6445b2 100644
> >--- a/tools/perf/util/map.h
> >+++ b/tools/perf/util/map.h
> >@@ -59,11 +59,20 @@ struct map_groups {
> > struct rb_root maps[MAP__NR_TYPES];
> > struct list_head removed_maps[MAP__NR_TYPES];
> > struct machine *machine;
> >+ int refcnt;
> > };
>
>
> atomic for refcnt? This is part of a libperf; would be good to
> support multithreaded users.

hum.. I think using atomic type is not enough, we'd need
to make map_groups__put/get atomic as well

not sure what's the support in user space for that.. will check

also not to be negative, but libperf is not thread safe anyway, right? ;-)

thanks,
jirka


\
 
 \ /
  Last update: 2014-04-15 12:21    [W:0.150 / U:8.564 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site