]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
perf tools: Provide mutex wrappers for pthreads rwlocks
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 4 Apr 2017 16:15:04 +0000 (13:15 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 21 Sep 2017 16:28:06 +0000 (13:28 -0300)
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>
18 files changed:
tools/perf/builtin-kvm.c
tools/perf/builtin-script.c
tools/perf/util/Build
tools/perf/util/dso.c
tools/perf/util/dso.h
tools/perf/util/machine.c
tools/perf/util/machine.h
tools/perf/util/map.c
tools/perf/util/map.h
tools/perf/util/rwsem.c [new file with mode: 0644]
tools/perf/util/rwsem.h [new file with mode: 0644]
tools/perf/util/symbol.c
tools/perf/util/thread.c
tools/perf/util/trace-event-info.c
tools/perf/util/trace-event-read.c
tools/perf/util/util.c
tools/perf/util/util.h
tools/perf/util/vdso.c

index f309c3773522dee5c5c8a515b1c278757fca58c6..c747a1af49fefa589a51312adec0b4aec27b6e9f 100644 (file)
@@ -34,7 +34,6 @@
 #include <termios.h>
 #include <semaphore.h>
 #include <signal.h>
-#include <pthread.h>
 #include <math.h>
 
 static const char *get_filename_for_perf_kvm(void)
index 725dbd3dd1044102194e1f89076e3ee072576a46..9092de0f72385a8d0f89d65920b34f7215300ad9 100644 (file)
@@ -2829,6 +2829,8 @@ int cmd_script(int argc, const char **argv)
                NULL
        };
 
+       perf_set_singlethreaded();
+
        setup_scripting();
 
        argc = parse_options_subcommand(argc, argv, options, script_subcommands, script_usage,
index 71ab8466714d8d86893db06a1f6f4af1cbd73502..369c3163e68c79d036a1b3c9b8110a9559c8b297 100644 (file)
@@ -79,6 +79,7 @@ libperf-y += data.o
 libperf-y += tsc.o
 libperf-y += cloexec.o
 libperf-y += call-path.o
+libperf-y += rwsem.o
 libperf-y += thread-stack.o
 libperf-$(CONFIG_AUXTRACE) += auxtrace.o
 libperf-$(CONFIG_AUXTRACE) += intel-pt-decoder/
index ffd723179a4bd74ecd6f613398dfef0d35304837..339e52971380bdb52484ac0cc34ae6639c3d8616 100644 (file)
@@ -1366,9 +1366,9 @@ void __dsos__add(struct dsos *dsos, struct dso *dso)
 
 void dsos__add(struct dsos *dsos, struct dso *dso)
 {
-       pthread_rwlock_wrlock(&dsos->lock);
+       down_write(&dsos->lock);
        __dsos__add(dsos, dso);
-       pthread_rwlock_unlock(&dsos->lock);
+       up_write(&dsos->lock);
 }
 
 struct dso *__dsos__find(struct dsos *dsos, const char *name, bool cmp_short)
@@ -1387,9 +1387,9 @@ struct dso *__dsos__find(struct dsos *dsos, const char *name, bool cmp_short)
 struct dso *dsos__find(struct dsos *dsos, const char *name, bool cmp_short)
 {
        struct dso *dso;
-       pthread_rwlock_rdlock(&dsos->lock);
+       down_read(&dsos->lock);
        dso = __dsos__find(dsos, name, cmp_short);
-       pthread_rwlock_unlock(&dsos->lock);
+       up_read(&dsos->lock);
        return dso;
 }
 
@@ -1416,9 +1416,9 @@ struct dso *__dsos__findnew(struct dsos *dsos, const char *name)
 struct dso *dsos__findnew(struct dsos *dsos, const char *name)
 {
        struct dso *dso;
-       pthread_rwlock_wrlock(&dsos->lock);
+       down_write(&dsos->lock);
        dso = dso__get(__dsos__findnew(dsos, name));
-       pthread_rwlock_unlock(&dsos->lock);
+       up_write(&dsos->lock);
        return dso;
 }
 
index f886141678ebaf816290fc4ca274e6ef10d6525b..a2bbb21f301cbb4499a2b7e6de3fcc76f6b34293 100644 (file)
@@ -6,7 +6,7 @@
 #include <linux/rbtree.h>
 #include <sys/types.h>
 #include <stdbool.h>
-#include <pthread.h>
+#include "rwsem.h"
 #include <linux/types.h>
 #include <linux/bitops.h>
 #include "map.h"
@@ -129,7 +129,7 @@ struct dso_cache {
 struct dsos {
        struct list_head head;
        struct rb_root   root;  /* rbtree root sorted by long name */
-       pthread_rwlock_t lock;
+       struct rw_semaphore lock;
 };
 
 struct auxtrace_cache;
index ddeea05eae86ba11857f6d1151d5feb1fe325a97..585b4a3d64a446421a6e3900cc715d8c08560368 100644 (file)
@@ -30,7 +30,7 @@ static void dsos__init(struct dsos *dsos)
 {
        INIT_LIST_HEAD(&dsos->head);
        dsos->root = RB_ROOT;
-       pthread_rwlock_init(&dsos->lock, NULL);
+       init_rwsem(&dsos->lock);
 }
 
 static void machine__threads_init(struct machine *machine)
@@ -40,7 +40,7 @@ static void machine__threads_init(struct machine *machine)
        for (i = 0; i < THREADS__TABLE_SIZE; i++) {
                struct threads *threads = &machine->threads[i];
                threads->entries = RB_ROOT;
-               pthread_rwlock_init(&threads->lock, NULL);
+               init_rwsem(&threads->lock);
                threads->nr = 0;
                INIT_LIST_HEAD(&threads->dead);
                threads->last_match = NULL;
@@ -130,7 +130,7 @@ static void dsos__purge(struct dsos *dsos)
 {
        struct dso *pos, *n;
 
-       pthread_rwlock_wrlock(&dsos->lock);
+       down_write(&dsos->lock);
 
        list_for_each_entry_safe(pos, n, &dsos->head, node) {
                RB_CLEAR_NODE(&pos->rb_node);
@@ -139,13 +139,13 @@ static void dsos__purge(struct dsos *dsos)
                dso__put(pos);
        }
 
-       pthread_rwlock_unlock(&dsos->lock);
+       up_write(&dsos->lock);
 }
 
 static void dsos__exit(struct dsos *dsos)
 {
        dsos__purge(dsos);
-       pthread_rwlock_destroy(&dsos->lock);
+       exit_rwsem(&dsos->lock);
 }
 
 void machine__delete_threads(struct machine *machine)
@@ -155,7 +155,7 @@ void machine__delete_threads(struct machine *machine)
 
        for (i = 0; i < THREADS__TABLE_SIZE; i++) {
                struct threads *threads = &machine->threads[i];
-               pthread_rwlock_wrlock(&threads->lock);
+               down_write(&threads->lock);
                nd = rb_first(&threads->entries);
                while (nd) {
                        struct thread *t = rb_entry(nd, struct thread, rb_node);
@@ -163,7 +163,7 @@ void machine__delete_threads(struct machine *machine)
                        nd = rb_next(nd);
                        __machine__remove_thread(machine, t, false);
                }
-               pthread_rwlock_unlock(&threads->lock);
+               up_write(&threads->lock);
        }
 }
 
@@ -180,7 +180,7 @@ void machine__exit(struct machine *machine)
 
        for (i = 0; i < THREADS__TABLE_SIZE; i++) {
                struct threads *threads = &machine->threads[i];
-               pthread_rwlock_destroy(&threads->lock);
+               exit_rwsem(&threads->lock);
        }
 }
 
@@ -482,9 +482,9 @@ struct thread *machine__findnew_thread(struct machine *machine, pid_t pid,
        struct threads *threads = machine__threads(machine, tid);
        struct thread *th;
 
-       pthread_rwlock_wrlock(&threads->lock);
+       down_write(&threads->lock);
        th = __machine__findnew_thread(machine, pid, tid);
-       pthread_rwlock_unlock(&threads->lock);
+       up_write(&threads->lock);
        return th;
 }
 
@@ -494,9 +494,9 @@ struct thread *machine__find_thread(struct machine *machine, pid_t pid,
        struct threads *threads = machine__threads(machine, tid);
        struct thread *th;
 
-       pthread_rwlock_rdlock(&threads->lock);
+       down_read(&threads->lock);
        th =  ____machine__findnew_thread(machine, threads, pid, tid, false);
-       pthread_rwlock_unlock(&threads->lock);
+       up_read(&threads->lock);
        return th;
 }
 
@@ -588,7 +588,7 @@ static struct dso *machine__findnew_module_dso(struct machine *machine,
 {
        struct dso *dso;
 
-       pthread_rwlock_wrlock(&machine->dsos.lock);
+       down_write(&machine->dsos.lock);
 
        dso = __dsos__find(&machine->dsos, m->name, true);
        if (!dso) {
@@ -602,7 +602,7 @@ static struct dso *machine__findnew_module_dso(struct machine *machine,
 
        dso__get(dso);
 out_unlock:
-       pthread_rwlock_unlock(&machine->dsos.lock);
+       up_write(&machine->dsos.lock);
        return dso;
 }
 
@@ -749,7 +749,8 @@ size_t machine__fprintf(struct machine *machine, FILE *fp)
 
        for (i = 0; i < THREADS__TABLE_SIZE; i++) {
                struct threads *threads = &machine->threads[i];
-               pthread_rwlock_rdlock(&threads->lock);
+
+               down_read(&threads->lock);
 
                ret = fprintf(fp, "Threads: %u\n", threads->nr);
 
@@ -759,7 +760,7 @@ size_t machine__fprintf(struct machine *machine, FILE *fp)
                        ret += thread__fprintf(pos, fp);
                }
 
-               pthread_rwlock_unlock(&threads->lock);
+               up_read(&threads->lock);
        }
        return ret;
 }
@@ -1319,7 +1320,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
                struct dso *kernel = NULL;
                struct dso *dso;
 
-               pthread_rwlock_rdlock(&machine->dsos.lock);
+               down_read(&machine->dsos.lock);
 
                list_for_each_entry(dso, &machine->dsos.head, node) {
 
@@ -1349,7 +1350,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
                        break;
                }
 
-               pthread_rwlock_unlock(&machine->dsos.lock);
+               up_read(&machine->dsos.lock);
 
                if (kernel == NULL)
                        kernel = machine__findnew_dso(machine, kmmap_prefix);
@@ -1513,7 +1514,7 @@ static void __machine__remove_thread(struct machine *machine, struct thread *th,
 
        BUG_ON(refcount_read(&th->refcnt) == 0);
        if (lock)
-               pthread_rwlock_wrlock(&threads->lock);
+               down_write(&threads->lock);
        rb_erase_init(&th->rb_node, &threads->entries);
        RB_CLEAR_NODE(&th->rb_node);
        --threads->nr;
@@ -1524,7 +1525,7 @@ static void __machine__remove_thread(struct machine *machine, struct thread *th,
         */
        list_add_tail(&th->node, &threads->dead);
        if (lock)
-               pthread_rwlock_unlock(&threads->lock);
+               up_write(&threads->lock);
        thread__put(th);
 }
 
index fe2f05848050a5b18afa069776303e2b152fe87d..b1cd516f202595926ec62e4a7582ec15ee5c8e67 100644 (file)
@@ -6,6 +6,7 @@
 #include "map.h"
 #include "dso.h"
 #include "event.h"
+#include "rwsem.h"
 
 struct addr_location;
 struct branch_stack;
@@ -28,7 +29,7 @@ struct vdso_info;
 
 struct threads {
        struct rb_root    entries;
-       pthread_rwlock_t  lock;
+       struct rw_semaphore lock;
        unsigned int      nr;
        struct list_head  dead;
        struct thread     *last_match;
index bdaa0a4edc17e344bdcae3a08dade7b276a6f5ee..5792d7a78152f5eb6f916f87358d5ac9a583f6ca 100644 (file)
@@ -488,7 +488,7 @@ u64 map__objdump_2mem(struct map *map, u64 ip)
 static void maps__init(struct maps *maps)
 {
        maps->entries = RB_ROOT;
-       pthread_rwlock_init(&maps->lock, NULL);
+       init_rwsem(&maps->lock);
 }
 
 void map_groups__init(struct map_groups *mg, struct machine *machine)
@@ -517,9 +517,9 @@ static void __maps__purge(struct maps *maps)
 
 static void maps__exit(struct maps *maps)
 {
-       pthread_rwlock_wrlock(&maps->lock);
+       down_write(&maps->lock);
        __maps__purge(maps);
-       pthread_rwlock_unlock(&maps->lock);
+       up_write(&maps->lock);
 }
 
 void map_groups__exit(struct map_groups *mg)
@@ -586,7 +586,7 @@ struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name,
        struct symbol *sym;
        struct rb_node *nd;
 
-       pthread_rwlock_rdlock(&maps->lock);
+       down_read(&maps->lock);
 
        for (nd = rb_first(&maps->entries); nd; nd = rb_next(nd)) {
                struct map *pos = rb_entry(nd, struct map, rb_node);
@@ -602,7 +602,7 @@ struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name,
 
        sym = NULL;
 out:
-       pthread_rwlock_unlock(&maps->lock);
+       up_read(&maps->lock);
        return sym;
 }
 
@@ -638,7 +638,7 @@ static size_t maps__fprintf(struct maps *maps, FILE *fp)
        size_t printed = 0;
        struct rb_node *nd;
 
-       pthread_rwlock_rdlock(&maps->lock);
+       down_read(&maps->lock);
 
        for (nd = rb_first(&maps->entries); nd; nd = rb_next(nd)) {
                struct map *pos = rb_entry(nd, struct map, rb_node);
@@ -650,7 +650,7 @@ static size_t maps__fprintf(struct maps *maps, FILE *fp)
                }
        }
 
-       pthread_rwlock_unlock(&maps->lock);
+       up_read(&maps->lock);
 
        return printed;
 }
@@ -682,7 +682,7 @@ static int maps__fixup_overlappings(struct maps *maps, struct map *map, FILE *fp
        struct rb_node *next;
        int err = 0;
 
-       pthread_rwlock_wrlock(&maps->lock);
+       down_write(&maps->lock);
 
        root = &maps->entries;
        next = rb_first(root);
@@ -750,7 +750,7 @@ static int maps__fixup_overlappings(struct maps *maps, struct map *map, FILE *fp
 
        err = 0;
 out:
-       pthread_rwlock_unlock(&maps->lock);
+       up_write(&maps->lock);
        return err;
 }
 
@@ -771,7 +771,7 @@ int map_groups__clone(struct thread *thread,
        struct map *map;
        struct maps *maps = &parent->maps[type];
 
-       pthread_rwlock_rdlock(&maps->lock);
+       down_read(&maps->lock);
 
        for (map = maps__first(maps); map; map = map__next(map)) {
                struct map *new = map__clone(map);
@@ -788,7 +788,7 @@ int map_groups__clone(struct thread *thread,
 
        err = 0;
 out_unlock:
-       pthread_rwlock_unlock(&maps->lock);
+       up_read(&maps->lock);
        return err;
 }
 
@@ -815,9 +815,9 @@ static void __maps__insert(struct maps *maps, struct map *map)
 
 void maps__insert(struct maps *maps, struct map *map)
 {
-       pthread_rwlock_wrlock(&maps->lock);
+       down_write(&maps->lock);
        __maps__insert(maps, map);
-       pthread_rwlock_unlock(&maps->lock);
+       up_write(&maps->lock);
 }
 
 static void __maps__remove(struct maps *maps, struct map *map)
@@ -828,9 +828,9 @@ static void __maps__remove(struct maps *maps, struct map *map)
 
 void maps__remove(struct maps *maps, struct map *map)
 {
-       pthread_rwlock_wrlock(&maps->lock);
+       down_write(&maps->lock);
        __maps__remove(maps, map);
-       pthread_rwlock_unlock(&maps->lock);
+       up_write(&maps->lock);
 }
 
 struct map *maps__find(struct maps *maps, u64 ip)
@@ -838,7 +838,7 @@ struct map *maps__find(struct maps *maps, u64 ip)
        struct rb_node **p, *parent = NULL;
        struct map *m;
 
-       pthread_rwlock_rdlock(&maps->lock);
+       down_read(&maps->lock);
 
        p = &maps->entries.rb_node;
        while (*p != NULL) {
@@ -854,7 +854,7 @@ struct map *maps__find(struct maps *maps, u64 ip)
 
        m = NULL;
 out:
-       pthread_rwlock_unlock(&maps->lock);
+       up_read(&maps->lock);
        return m;
 }
 
index 73aacf7a7dc4b0772f4021760d21b6efca12c327..d5d7442dac7a71fb6c39617e5e1196e10af1cff2 100644 (file)
@@ -9,6 +9,7 @@
 #include <stdio.h>
 #include <stdbool.h>
 #include <linux/types.h>
+#include "rwsem.h"
 
 enum map_type {
        MAP__FUNCTION = 0,
@@ -61,7 +62,7 @@ struct kmap {
 
 struct maps {
        struct rb_root   entries;
-       pthread_rwlock_t lock;
+       struct rw_semaphore lock;
 };
 
 struct map_groups {
diff --git a/tools/perf/util/rwsem.c b/tools/perf/util/rwsem.c
new file mode 100644 (file)
index 0000000..5e52e7b
--- /dev/null
@@ -0,0 +1,32 @@
+#include "util.h"
+#include "rwsem.h"
+
+int init_rwsem(struct rw_semaphore *sem)
+{
+       return pthread_rwlock_init(&sem->lock, NULL);
+}
+
+int exit_rwsem(struct rw_semaphore *sem)
+{
+       return pthread_rwlock_destroy(&sem->lock);
+}
+
+int down_read(struct rw_semaphore *sem)
+{
+       return perf_singlethreaded ? 0 : pthread_rwlock_rdlock(&sem->lock);
+}
+
+int up_read(struct rw_semaphore *sem)
+{
+       return perf_singlethreaded ? 0 : pthread_rwlock_unlock(&sem->lock);
+}
+
+int down_write(struct rw_semaphore *sem)
+{
+       return perf_singlethreaded ? 0 : pthread_rwlock_wrlock(&sem->lock);
+}
+
+int up_write(struct rw_semaphore *sem)
+{
+       return perf_singlethreaded ? 0 : pthread_rwlock_unlock(&sem->lock);
+}
diff --git a/tools/perf/util/rwsem.h b/tools/perf/util/rwsem.h
new file mode 100644 (file)
index 0000000..94565ad
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef _PERF_RWSEM_H
+#define _PERF_RWSEM_H
+
+#include <pthread.h>
+
+struct rw_semaphore {
+       pthread_rwlock_t lock;
+};
+
+int init_rwsem(struct rw_semaphore *sem);
+int exit_rwsem(struct rw_semaphore *sem);
+
+int down_read(struct rw_semaphore *sem);
+int up_read(struct rw_semaphore *sem);
+
+int down_write(struct rw_semaphore *sem);
+int up_write(struct rw_semaphore *sem);
+
+#endif /* _PERF_RWSEM_H */
index 5909ee4c7ade439c4f060724fad05927d2eff34d..066e38aa40634443eddb1fbde4bd69bd15a5cde8 100644 (file)
@@ -226,7 +226,7 @@ void __map_groups__fixup_end(struct map_groups *mg, enum map_type type)
        struct maps *maps = &mg->maps[type];
        struct map *next, *curr;
 
-       pthread_rwlock_wrlock(&maps->lock);
+       down_write(&maps->lock);
 
        curr = maps__first(maps);
        if (curr == NULL)
@@ -246,7 +246,7 @@ void __map_groups__fixup_end(struct map_groups *mg, enum map_type type)
                curr->end = ~0ULL;
 
 out_unlock:
-       pthread_rwlock_unlock(&maps->lock);
+       up_write(&maps->lock);
 }
 
 struct symbol *symbol__new(u64 start, u64 len, u8 binding, const char *name)
@@ -1671,7 +1671,7 @@ struct map *map_groups__find_by_name(struct map_groups *mg,
        struct maps *maps = &mg->maps[type];
        struct map *map;
 
-       pthread_rwlock_rdlock(&maps->lock);
+       down_read(&maps->lock);
 
        for (map = maps__first(maps); map; map = map__next(map)) {
                if (map->dso && strcmp(map->dso->short_name, name) == 0)
@@ -1681,7 +1681,7 @@ struct map *map_groups__find_by_name(struct map_groups *mg,
        map = NULL;
 
 out_unlock:
-       pthread_rwlock_unlock(&maps->lock);
+       up_read(&maps->lock);
        return map;
 }
 
index aee9a42102bac264e89e3e698431975006c9681c..c09bdb509d823d1e9bcf5e93564a773fa20bd90d 100644 (file)
@@ -264,7 +264,7 @@ static int __thread__prepare_access(struct thread *thread)
                struct maps *maps = &thread->mg->maps[i];
                struct map *map;
 
-               pthread_rwlock_rdlock(&maps->lock);
+               down_read(&maps->lock);
 
                for (map = maps__first(maps); map; map = map__next(map)) {
                        err = unwind__prepare_access(thread, map, &initialized);
@@ -272,7 +272,7 @@ static int __thread__prepare_access(struct thread *thread)
                                break;
                }
 
-               pthread_rwlock_unlock(&maps->lock);
+               up_read(&maps->lock);
        }
 
        return err;
index e7d60d05596d2ff54aa6f8ec1d2a0b8afcd17546..d7f2113462fbb97b3fb9e44294cd1be732831a45 100644 (file)
@@ -28,7 +28,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
-#include <pthread.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
index 8a9a677f75768205c47343c126813808e564a38a..40b425949aa31d7b4b334fa5923436f57dd2c842 100644 (file)
@@ -27,7 +27,6 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <sys/mman.h>
-#include <pthread.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
index 3c9c39711343917e54cd52c4412b8a99708c77b7..97e0c8e26477a88deebc9164fc737584b658fe73 100644 (file)
 /*
  * XXX We need to find a better place for these things...
  */
+
+bool perf_singlethreaded = true;
+
+void perf_set_singlethreaded(void)
+{
+       perf_singlethreaded = true;
+}
+
+void perf_set_multithreaded(void)
+{
+       perf_singlethreaded = false;
+}
+
 unsigned int page_size;
 int cacheline_size;
 
index 03946d5e4741f51fd0fff14c6af11d5bb752b0a5..6c7e6cc902bb3b247bf910e531515546288b91b9 100644 (file)
@@ -62,4 +62,9 @@ int sched_getcpu(void);
 int setns(int fd, int nstype);
 #endif
 
+extern bool perf_singlethreaded;
+
+void perf_set_singlethreaded(void);
+void perf_set_multithreaded(void);
+
 #endif /* GIT_COMPAT_UTIL_H */
index d3c39eec89a85b64f724bf27466c3dabc15a1029..f5f843d3c22f59f47a457be449fb0556dce4d36f 100644 (file)
@@ -319,7 +319,7 @@ struct dso *machine__findnew_vdso(struct machine *machine,
        struct vdso_info *vdso_info;
        struct dso *dso = NULL;
 
-       pthread_rwlock_wrlock(&machine->dsos.lock);
+       down_write(&machine->dsos.lock);
        if (!machine->vdso_info)
                machine->vdso_info = vdso_info__new();
 
@@ -347,7 +347,7 @@ struct dso *machine__findnew_vdso(struct machine *machine,
 
 out_unlock:
        dso__get(dso);
-       pthread_rwlock_unlock(&machine->dsos.lock);
+       up_write(&machine->dsos.lock);
        return dso;
 }