Skip to content

Commit 15eb7c8

Browse files
Mike GalbraithKAGA-KOKO
authored andcommitted
locking/rwsem: Add missing __init_rwsem() for PREEMPT_RT
730633f 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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8596e58 commit 15eb7c8

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

include/linux/rwsem.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,14 @@ struct rw_semaphore {
142142
#define DECLARE_RWSEM(lockname) \
143143
struct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname)
144144

145-
#ifdef CONFIG_DEBUG_LOCK_ALLOC
146-
extern void __rwsem_init(struct rw_semaphore *rwsem, const char *name,
145+
extern void __init_rwsem(struct rw_semaphore *rwsem, const char *name,
147146
struct lock_class_key *key);
148-
#else
149-
static inline void __rwsem_init(struct rw_semaphore *rwsem, const char *name,
150-
struct lock_class_key *key)
151-
{
152-
}
153-
#endif
154147

155148
#define init_rwsem(sem) \
156149
do { \
157150
static struct lock_class_key __key; \
158151
\
159-
init_rwbase_rt(&(sem)->rwbase); \
160-
__rwsem_init((sem), #sem, &__key); \
152+
__init_rwsem((sem), #sem, &__key); \
161153
} while (0)
162154

163155
static __always_inline int rwsem_is_locked(struct rw_semaphore *sem)

kernel/locking/rwsem.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,15 +1376,17 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
13761376

13771377
#include "rwbase_rt.c"
13781378

1379-
#ifdef CONFIG_DEBUG_LOCK_ALLOC
1380-
void __rwsem_init(struct rw_semaphore *sem, const char *name,
1379+
void __init_rwsem(struct rw_semaphore *sem, const char *name,
13811380
struct lock_class_key *key)
13821381
{
1382+
init_rwbase_rt(&(sem)->rwbase);
1383+
1384+
#ifdef CONFIG_DEBUG_LOCK_ALLOC
13831385
debug_check_no_locks_freed((void *)sem, sizeof(*sem));
13841386
lockdep_init_map_wait(&sem->dep_map, name, key, 0, LD_WAIT_SLEEP);
1385-
}
1386-
EXPORT_SYMBOL(__rwsem_init);
13871387
#endif
1388+
}
1389+
EXPORT_SYMBOL(__init_rwsem);
13881390

13891391
static inline void __down_read(struct rw_semaphore *sem)
13901392
{

0 commit comments

Comments
 (0)