[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 3 Mar 2015 10:57:25 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
Adrian Hunter <adrian.hunter@...el.com>,
Borislav Petkov <bp@...e.de>, David Ahern <dsahern@...il.com>,
Don Zickus <dzickus@...hat.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Jiri Olsa <jolsa@...hat.com>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 19/20] perf tools: Reference count struct thread
Em Tue, Mar 03, 2015 at 10:42:14PM +0900, Namhyung Kim escreveu:
> On Tue, Mar 03, 2015 at 12:26:08AM -0300, Arnaldo Carvalho de Melo wrote:
> > +++ b/tools/perf/util/thread.c
> > @@ -82,6 +82,20 @@ void thread__delete(struct thread *thread)
> > +struct thread *thread__get(struct thread *thread)
> > +{
> > + ++thread->refcnt;
> > + return thread;
> > +}
> > +void thread__put(struct thread *thread)
> > +{
> > + if (thread && --thread->refcnt == 0) {
> > + list_del_init(&thread->node);
> > + thread__delete(thread);
> > + }
> > +}
> I think we need to protect refcnt from concurrent accesses from
> multiple threads. Not to mention my multi-thread work, perf top
> already uses two threads.
Sure
> For perf top case, hist_entry__new() will be called from main thread
> and hist_entry__delete() might be called from display thread.
Reference counting is a step in that direction, as to if the integer
inc/dec is enough or is already surrounded by existing serialization
needs to be checked.
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists