1 #ifndef _LINUX_PERCPU_RWSEM_H
2 #define _LINUX_PERCPU_RWSEM_H
4 #include <linux/mutex.h>
5 #include <linux/rwsem.h>
6 #include <linux/percpu.h>
7 #include <linux/wait.h>
9 struct percpu_rw_semaphore {
10 unsigned int __percpu *fast_read_ctr;
11 struct mutex writer_mutex;
12 struct rw_semaphore rw_sem;
13 atomic_t slow_read_ctr;
14 wait_queue_head_t write_waitq;
17 extern void percpu_down_read(struct percpu_rw_semaphore *);
18 extern void percpu_up_read(struct percpu_rw_semaphore *);
20 extern void percpu_down_write(struct percpu_rw_semaphore *);
21 extern void percpu_up_write(struct percpu_rw_semaphore *);
23 extern int percpu_init_rwsem(struct percpu_rw_semaphore *);
24 extern void percpu_free_rwsem(struct percpu_rw_semaphore *);