Skip to content

Commit 5f4c01f

Browse files
Leonardo BrasKent Overstreet
authored andcommitted
spinlock: Fix failing build for PREEMPT_RT
Since 1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to spinlock.h") build fails for PREEMPT_RT, since there is no definition available of either spin_needbreak() and rwlock_needbreak(). Since it was moved on the mentioned commit, it was placed inside a !PREEMPT_RT part of the code, making it out of reach for an RT kernel. Fix this by moving code it a few lines down so it can be reached by an RT build, where it can also make use of the *_is_contended() definition added by the spinlock_rt.h. Fixes: d1d71b3 ("sched.h: Move (spin|rwlock)_needbreak() to spinlock.h") Signed-off-by: Leonardo Bras <[email protected]> Signed-off-by: Kent Overstreet <[email protected]> Acked-by: Waiman Long <[email protected]>
1 parent 1e2f2d3 commit 5f4c01f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/linux/spinlock.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,12 @@ static __always_inline int spin_is_contended(spinlock_t *lock)
449449
return raw_spin_is_contended(&lock->rlock);
450450
}
451451

452+
#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)
453+
454+
#else /* !CONFIG_PREEMPT_RT */
455+
# include <linux/spinlock_rt.h>
456+
#endif /* CONFIG_PREEMPT_RT */
457+
452458
/*
453459
* Does a critical section need to be broken due to another
454460
* task waiting?: (technically does not depend on CONFIG_PREEMPTION,
@@ -480,12 +486,6 @@ static inline int rwlock_needbreak(rwlock_t *lock)
480486
#endif
481487
}
482488

483-
#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)
484-
485-
#else /* !CONFIG_PREEMPT_RT */
486-
# include <linux/spinlock_rt.h>
487-
#endif /* CONFIG_PREEMPT_RT */
488-
489489
/*
490490
* Pull the atomic_t declaration:
491491
* (asm-mips/atomic.h needs above definitions)

0 commit comments

Comments
 (0)