mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
0a7c74eae3
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>
20 lines
393 B
C
20 lines
393 B
C
#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 */
|