aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorUros Bizjak <[email protected]>2024-05-28 16:43:13 +0200
committerAndrew Morton <[email protected]>2024-07-03 19:30:02 -0700
commit21664442be1bf79094dd9d21b8833acbfbd80ea7 (patch)
tree8dfb8832422b524539b4b9ecd56261c6ab3bd36a /include/linux
parentfefc6e6631ff43427e81f08c8e49f7787ff0213a (diff)
percpu: add __this_cpu_try_cmpxchg()
Add __this_cpu_try_cmpxchg() version of the percpu op. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Uros Bizjak <[email protected]> Reviewed-by: Uladzislau Rezki (Sony) <[email protected]> Acked-by: Dennis Zhou <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Christoph Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/percpu-defs.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index ec3573119923..8efce7414fad 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -475,6 +475,12 @@ do { \
raw_cpu_cmpxchg(pcp, oval, nval); \
})
+#define __this_cpu_try_cmpxchg(pcp, ovalp, nval) \
+({ \
+ __this_cpu_preempt_check("try_cmpxchg"); \
+ raw_cpu_try_cmpxchg(pcp, ovalp, nval); \
+})
+
#define __this_cpu_sub(pcp, val) __this_cpu_add(pcp, -(typeof(pcp))(val))
#define __this_cpu_inc(pcp) __this_cpu_add(pcp, 1)
#define __this_cpu_dec(pcp) __this_cpu_sub(pcp, 1)