mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
Merge tag 'locking-core-2023-05-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking updates from Ingo Molnar: - Introduce local{,64}_try_cmpxchg() - a slightly more optimal primitive, which will be used in perf events ring-buffer code - Simplify/modify rwsems on PREEMPT_RT, to address writer starvation - Misc cleanups/fixes * tag 'locking-core-2023-05-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking/atomic: Correct (cmp)xchg() instrumentation locking/x86: Define arch_try_cmpxchg_local() locking/arch: Wire up local_try_cmpxchg() locking/generic: Wire up local{,64}_try_cmpxchg() locking/atomic: Add generic try_cmpxchg{,64}_local() support locking/rwbase: Mitigate indefinite writer starvation locking/arch: Rename all internal __xchg() names to __arch_xchg()
This commit is contained in:
@@ -6,15 +6,15 @@
|
||||
* Atomic exchange routines.
|
||||
*/
|
||||
|
||||
#define ____xchg(type, args...) __xchg ## type ## _local(args)
|
||||
#define ____xchg(type, args...) __arch_xchg ## type ## _local(args)
|
||||
#define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args)
|
||||
#include <asm/xchg.h>
|
||||
|
||||
#define xchg_local(ptr, x) \
|
||||
({ \
|
||||
__typeof__(*(ptr)) _x_ = (x); \
|
||||
(__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \
|
||||
sizeof(*(ptr))); \
|
||||
(__typeof__(*(ptr))) __arch_xchg_local((ptr), (unsigned long)_x_,\
|
||||
sizeof(*(ptr))); \
|
||||
})
|
||||
|
||||
#define arch_cmpxchg_local(ptr, o, n) \
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#undef ____xchg
|
||||
#undef ____cmpxchg
|
||||
#define ____xchg(type, args...) __xchg ##type(args)
|
||||
#define ____xchg(type, args...) __arch_xchg ##type(args)
|
||||
#define ____cmpxchg(type, args...) __cmpxchg ##type(args)
|
||||
#include <asm/xchg.h>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
__typeof__(*(ptr)) _x_ = (x); \
|
||||
smp_mb(); \
|
||||
__ret = (__typeof__(*(ptr))) \
|
||||
__xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
|
||||
__arch_xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
|
||||
smp_mb(); \
|
||||
__ret; \
|
||||
})
|
||||
|
@@ -52,8 +52,16 @@ static __inline__ long local_sub_return(long i, local_t * l)
|
||||
return result;
|
||||
}
|
||||
|
||||
#define local_cmpxchg(l, o, n) \
|
||||
(cmpxchg_local(&((l)->a.counter), (o), (n)))
|
||||
static __inline__ long local_cmpxchg(local_t *l, long old, long new)
|
||||
{
|
||||
return cmpxchg_local(&l->a.counter, old, new);
|
||||
}
|
||||
|
||||
static __inline__ bool local_try_cmpxchg(local_t *l, long *old, long new)
|
||||
{
|
||||
return try_cmpxchg_local(&l->a.counter, (s64 *)old, new);
|
||||
}
|
||||
|
||||
#define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n)))
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user