diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-04-07 11:59:50 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-05-08 16:16:23 -0300 |
commit | e1ed3a5b87ed6759e16ec93f16aae83d2cc77ca2 (patch) | |
tree | 5eb80c8b87ad735bca3f9ce50751da06f8b63f1e /tools/perf/util/thread.h | |
parent | da6d8567512df11e0473b710c07de87efde5709c (diff) |
perf tools: Use atomic_t to implement thread__{get,put} refcnt
Fixing bugs in 'perf top' where the used thread unsafe 'struct thread'
refcount implementation was falling apart because we really use two
threads.
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-hil2hol294u5ntcuof4jhmn6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/thread.h')
-rw-r--r-- | tools/perf/util/thread.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index 9b8a54dc34a8..f33c48cfdaa0 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h @@ -1,6 +1,7 @@ #ifndef __PERF_THREAD_H #define __PERF_THREAD_H +#include <linux/atomic.h> #include <linux/rbtree.h> #include <linux/list.h> #include <unistd.h> @@ -21,7 +22,7 @@ struct thread { pid_t tid; pid_t ppid; int cpu; - int refcnt; + atomic_t refcnt; char shortname[3]; bool comm_set; bool dead; /* if set thread has exited */ |