Skip to content

Commit fa37b3b

Browse files
committed
Merge tag 'locking-urgent-2024-04-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fix from Ingo Molnar: "Fix a PREEMPT_RT build bug" * tag 'locking-urgent-2024-04-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking: Make rwsem_assert_held_write_nolockdep() build with PREEMPT_RT=y
2 parents c28275e + fa1f511 commit fa37b3b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/linux/rwbase_rt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ static __always_inline bool rw_base_is_locked(const struct rwbase_rt *rwb)
3131
return atomic_read(&rwb->readers) != READER_BIAS;
3232
}
3333

34-
static inline void rw_base_assert_held_write(const struct rwbase_rt *rwb)
34+
static __always_inline bool rw_base_is_write_locked(const struct rwbase_rt *rwb)
3535
{
36-
WARN_ON(atomic_read(&rwb->readers) != WRITER_BIAS);
36+
return atomic_read(&rwb->readers) == WRITER_BIAS;
3737
}
3838

3939
static __always_inline bool rw_base_is_contended(const struct rwbase_rt *rwb)

include/linux/rwsem.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ static __always_inline int rwsem_is_locked(const struct rw_semaphore *sem)
167167
return rw_base_is_locked(&sem->rwbase);
168168
}
169169

170-
static inline void rwsem_assert_held_nolockdep(const struct rw_semaphore *sem)
170+
static __always_inline void rwsem_assert_held_nolockdep(const struct rw_semaphore *sem)
171171
{
172172
WARN_ON(!rwsem_is_locked(sem));
173173
}
174174

175-
static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)
175+
static __always_inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)
176176
{
177-
rw_base_assert_held_write(sem);
177+
WARN_ON(!rw_base_is_write_locked(&sem->rwbase));
178178
}
179179

180180
static __always_inline int rwsem_is_contended(struct rw_semaphore *sem)

0 commit comments

Comments
 (0)