linux/include/linux/percpu-rwsem.h
<<
>>
Prefs
   1#ifndef _LINUX_PERCPU_RWSEM_H
   2#define _LINUX_PERCPU_RWSEM_H
   3
   4#include <linux/atomic.h>
   5#include <linux/rwsem.h>
   6#include <linux/percpu.h>
   7#include <linux/wait.h>
   8#include <linux/lockdep.h>
   9
  10struct percpu_rw_semaphore {
  11        unsigned int __percpu   *fast_read_ctr;
  12        atomic_t                write_ctr;
  13        struct rw_semaphore     rw_sem;
  14        atomic_t                slow_read_ctr;
  15        wait_queue_head_t       write_waitq;
  16};
  17
  18extern void percpu_down_read(struct percpu_rw_semaphore *);
  19extern void percpu_up_read(struct percpu_rw_semaphore *);
  20
  21extern void percpu_down_write(struct percpu_rw_semaphore *);
  22extern void percpu_up_write(struct percpu_rw_semaphore *);
  23
  24extern int __percpu_init_rwsem(struct percpu_rw_semaphore *,
  25                                const char *, struct lock_class_key *);
  26extern void percpu_free_rwsem(struct percpu_rw_semaphore *);
  27
  28#define percpu_init_rwsem(brw)  \
  29({                                                              \
  30        static struct lock_class_key rwsem_key;                 \
  31        __percpu_init_rwsem(brw, #brw, &rwsem_key);             \
  32})
  33
  34#endif
  35
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.