]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - include/linux/percpu-rwsem.h
Apply preempt_rt patch-4.9-rt1.patch.xz
[zynq/linux.git] / include / linux / percpu-rwsem.h
index 5b2e6159b744a35a845a82e9213295be754fbabd..ea940f451606db7265c8ef9fdd6396814549867f 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/atomic.h>
 #include <linux/rwsem.h>
 #include <linux/percpu.h>
-#include <linux/wait.h>
+#include <linux/swait.h>
 #include <linux/rcu_sync.h>
 #include <linux/lockdep.h>
 
@@ -12,7 +12,7 @@ struct percpu_rw_semaphore {
        struct rcu_sync         rss;
        unsigned int __percpu   *read_count;
        struct rw_semaphore     rw_sem;
-       wait_queue_head_t       writer;
+       struct swait_queue_head writer;
        int                     readers_block;
 };
 
@@ -22,13 +22,13 @@ static struct percpu_rw_semaphore name = {                          \
        .rss = __RCU_SYNC_INITIALIZER(name.rss, RCU_SCHED_SYNC),        \
        .read_count = &__percpu_rwsem_rc_##name,                        \
        .rw_sem = __RWSEM_INITIALIZER(name.rw_sem),                     \
-       .writer = __WAIT_QUEUE_HEAD_INITIALIZER(name.writer),           \
+       .writer = __SWAIT_QUEUE_HEAD_INITIALIZER(name.writer),          \
 }
 
 extern int __percpu_down_read(struct percpu_rw_semaphore *, int);
 extern void __percpu_up_read(struct percpu_rw_semaphore *);
 
-static inline void percpu_down_read_preempt_disable(struct percpu_rw_semaphore *sem)
+static inline void percpu_down_read(struct percpu_rw_semaphore *sem)
 {
        might_sleep();
 
@@ -46,16 +46,10 @@ static inline void percpu_down_read_preempt_disable(struct percpu_rw_semaphore *
        __this_cpu_inc(*sem->read_count);
        if (unlikely(!rcu_sync_is_idle(&sem->rss)))
                __percpu_down_read(sem, false); /* Unconditional memory barrier */
-       barrier();
        /*
-        * The barrier() prevents the compiler from
+        * The preempt_enable() prevents the compiler from
         * bleeding the critical section out.
         */
-}
-
-static inline void percpu_down_read(struct percpu_rw_semaphore *sem)
-{
-       percpu_down_read_preempt_disable(sem);
        preempt_enable();
 }
 
@@ -82,13 +76,9 @@ static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
        return ret;
 }
 
-static inline void percpu_up_read_preempt_enable(struct percpu_rw_semaphore *sem)
+static inline void percpu_up_read(struct percpu_rw_semaphore *sem)
 {
-       /*
-        * The barrier() prevents the compiler from
-        * bleeding the critical section out.
-        */
-       barrier();
+       preempt_disable();
        /*
         * Same as in percpu_down_read().
         */
@@ -101,12 +91,6 @@ static inline void percpu_up_read_preempt_enable(struct percpu_rw_semaphore *sem
        rwsem_release(&sem->rw_sem.dep_map, 1, _RET_IP_);
 }
 
-static inline void percpu_up_read(struct percpu_rw_semaphore *sem)
-{
-       preempt_disable();
-       percpu_up_read_preempt_enable(sem);
-}
-
 extern void percpu_down_write(struct percpu_rw_semaphore *);
 extern void percpu_up_write(struct percpu_rw_semaphore *);