summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2025-09-22 17:09:17 +0300
committerPeter Zijlstra <peterz@infradead.org>2025-10-29 12:29:57 +0300
commit639214f65b1db87c6992eadf93079ff0d8768c2d (patch)
tree7254bb68b382ea47e8555af40c53065de5c4b2b7 /include/linux
parent42b9138f81fc22c36128f9524bb21bc9eabfb1b8 (diff)
downloadlinux-639214f65b1db87c6992eadf93079ff0d8768c2d.tar.xz
unwind: Make unwind_task_info::unwind_mask consistent
The unwind_task_info::unwind_mask was manipulated using a mixture of: regular store WRITE_ONCE() try_cmpxchg() set_bit() atomic_long_*() Clean up and make it consistently atomic_long_t. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20250924080119.384384486@infradead.org
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/unwind_deferred.h4
-rw-r--r--include/linux/unwind_deferred_types.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/unwind_deferred.h b/include/linux/unwind_deferred.h
index 196e12c1449e..f4743c8cff4c 100644
--- a/include/linux/unwind_deferred.h
+++ b/include/linux/unwind_deferred.h
@@ -46,7 +46,7 @@ void unwind_deferred_task_exit(struct task_struct *task);
static __always_inline void unwind_reset_info(void)
{
struct unwind_task_info *info = &current->unwind_info;
- unsigned long bits = info->unwind_mask;
+ unsigned long bits = atomic_long_read(&info->unwind_mask);
/* Was there any unwinding? */
if (likely(!bits))
@@ -56,7 +56,7 @@ static __always_inline void unwind_reset_info(void)
/* Is a task_work going to run again before going back */
if (bits & UNWIND_PENDING)
return;
- } while (!try_cmpxchg(&info->unwind_mask, &bits, 0UL));
+ } while (!atomic_long_try_cmpxchg(&info->unwind_mask, &bits, 0UL));
current->unwind_info.id.id = 0;
if (unlikely(info->cache)) {
diff --git a/include/linux/unwind_deferred_types.h b/include/linux/unwind_deferred_types.h
index 29452ff49859..0a4c8ddbbc57 100644
--- a/include/linux/unwind_deferred_types.h
+++ b/include/linux/unwind_deferred_types.h
@@ -3,6 +3,7 @@
#define _LINUX_UNWIND_USER_DEFERRED_TYPES_H
#include <linux/types.h>
+#include <linux/atomic.h>
struct unwind_cache {
unsigned long unwind_completed;
@@ -32,7 +33,7 @@ union unwind_task_id {
};
struct unwind_task_info {
- unsigned long unwind_mask;
+ atomic_long_t unwind_mask;
struct unwind_cache *cache;
struct callback_head work;
union unwind_task_id id;