aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/vdso.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2017-04-04 12:15:04 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-09-21 12:28:06 -0400
commit0a7c74eae307894c6c95316c382f118aef8481e8 (patch)
tree104338da632148c09cf33c436dad10eb608740da /tools/perf/util/vdso.c
parent6ae8eefc6c8fe050f057781b70a83262eb0a61ee (diff)
perf tools: Provide mutex wrappers for pthreads rwlocks
Andi reported a performance drop in single threaded perf tools such as 'perf script' due to the growing number of locks being put in place to allow for multithreaded tools, so wrap the POSIX threads rwlock routines with the names used for such kinds of locks in the Linux kernel and then allow for tools to ask for those locks to be used or not. I.e. a tool may have a multithreaded phase and then switch to single threaded, like the upcoming patches for the synthesizing of PERF_RECORD_{FORK,MMAP,etc} for pre-existing processes to then switch to single threaded mode in 'perf top'. The init routines will not be conditional, this way starting as single threaded to then move to multi threaded mode should be possible. Reported-by: Andi Kleen <ak@linux.intel.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/20170404161739.GH12903@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/vdso.c')
-rw-r--r--tools/perf/util/vdso.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
index d3c39eec89a8..f5f843d3c22f 100644
--- a/tools/perf/util/vdso.c
+++ b/tools/perf/util/vdso.c
@@ -319,7 +319,7 @@ struct dso *machine__findnew_vdso(struct machine *machine,
319 struct vdso_info *vdso_info; 319 struct vdso_info *vdso_info;
320 struct dso *dso = NULL; 320 struct dso *dso = NULL;
321 321
322 pthread_rwlock_wrlock(&machine->dsos.lock); 322 down_write(&machine->dsos.lock);
323 if (!machine->vdso_info) 323 if (!machine->vdso_info)
324 machine->vdso_info = vdso_info__new(); 324 machine->vdso_info = vdso_info__new();
325 325
@@ -347,7 +347,7 @@ struct dso *machine__findnew_vdso(struct machine *machine,
347 347
348out_unlock: 348out_unlock:
349 dso__get(dso); 349 dso__get(dso);
350 pthread_rwlock_unlock(&machine->dsos.lock); 350 up_write(&machine->dsos.lock);
351 return dso; 351 return dso;
352} 352}
353 353