locking/rwsem: Add missing __init_rwsem() for PREEMPT_RT
authorMike Galbraith <efault@gmx.de>
Tue, 31 Aug 2021 06:38:19 +0000 (08:38 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 2 Sep 2021 20:07:17 +0000 (22:07 +0200)
730633f0b7f95 became the first direct caller of __init_rwsem() vs the
usual init_rwsem(), exposing PREEMPT_RT's lack thereof.  Add it.

[ tglx: Move it out of line ]

Signed-off-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/50a936b7d8f12277d6ec7ed2ef0421a381056909.camel@gmx.de
include/linux/rwsem.h
kernel/locking/rwsem.c

index 426e98e0b675c7924a46e7114536a970dfb8cec5..352c6127cb90fa8623c97a65b675319b5faa0f59 100644 (file)
@@ -142,22 +142,14 @@ struct rw_semaphore {
 #define DECLARE_RWSEM(lockname) \
        struct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname)
 
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-extern void  __rwsem_init(struct rw_semaphore *rwsem, const char *name,
+extern void  __init_rwsem(struct rw_semaphore *rwsem, const char *name,
                          struct lock_class_key *key);
-#else
-static inline void  __rwsem_init(struct rw_semaphore *rwsem, const char *name,
-                                struct lock_class_key *key)
-{
-}
-#endif
 
 #define init_rwsem(sem)                                                \
 do {                                                           \
        static struct lock_class_key __key;                     \
                                                                \
-       init_rwbase_rt(&(sem)->rwbase);                 \
-       __rwsem_init((sem), #sem, &__key);                      \
+       __init_rwsem((sem), #sem, &__key);                      \
 } while (0)
 
 static __always_inline int rwsem_is_locked(struct rw_semaphore *sem)
index 9215b4d6a9de14e77527344e4c2f31733b4ccef7..000e8d5a288419ba41a570ed846f8d81550fbcc7 100644 (file)
@@ -1376,15 +1376,17 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
 
 #include "rwbase_rt.c"
 
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-void __rwsem_init(struct rw_semaphore *sem, const char *name,
+void __init_rwsem(struct rw_semaphore *sem, const char *name,
                  struct lock_class_key *key)
 {
+       init_rwbase_rt(&(sem)->rwbase);
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
        debug_check_no_locks_freed((void *)sem, sizeof(*sem));
        lockdep_init_map_wait(&sem->dep_map, name, key, 0, LD_WAIT_SLEEP);
-}
-EXPORT_SYMBOL(__rwsem_init);
 #endif
+}
+EXPORT_SYMBOL(__init_rwsem);
 
 static inline void __down_read(struct rw_semaphore *sem)
 {