mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
s390/preempt: Use arch_try_cmpxchg() instead of __atomic_cmpxchg()
Use arch_try_cmpxchg() instead of __atomic_cmpxchg() in preempt_count_set() to generate similar or better code, depending in compiler features. Reviewed-by: Juergen Christ <jchrist@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
5ba865ad57
commit
75a98ed6fa
|
|
@ -5,6 +5,7 @@
|
|||
#include <asm/current.h>
|
||||
#include <linux/thread_info.h>
|
||||
#include <asm/atomic_ops.h>
|
||||
#include <asm/cmpxchg.h>
|
||||
#include <asm/march.h>
|
||||
|
||||
#ifdef MARCH_HAS_Z196_FEATURES
|
||||
|
|
@ -22,12 +23,10 @@ static __always_inline void preempt_count_set(int pc)
|
|||
{
|
||||
int old, new;
|
||||
|
||||
old = READ_ONCE(get_lowcore()->preempt_count);
|
||||
do {
|
||||
old = READ_ONCE(get_lowcore()->preempt_count);
|
||||
new = (old & PREEMPT_NEED_RESCHED) |
|
||||
(pc & ~PREEMPT_NEED_RESCHED);
|
||||
} while (__atomic_cmpxchg(&get_lowcore()->preempt_count,
|
||||
old, new) != old);
|
||||
new = (old & PREEMPT_NEED_RESCHED) | (pc & ~PREEMPT_NEED_RESCHED);
|
||||
} while (!arch_try_cmpxchg(&get_lowcore()->preempt_count, &old, new));
|
||||
}
|
||||
|
||||
static __always_inline void set_preempt_need_resched(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user