Re: [patch 1/8] futex: Move futex task related data into a struct
From: André Almeida
Date: Mon Mar 16 2026 - 22:25:41 EST
Em 16/03/2026 14:12, Thomas Gleixner escreveu:
Having all these members in task_struct along with the required #ifdeffery
is annoying, does not allow efficient initializing of the data with
memset() and makes extending it tedious.
Move it into a data structure and fix up all usage sites.
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
[...]
+
+#ifdef CONFIG_FUTEX
+#include <linux/mutex_types.h>
+#include <linux/types.h>
+
+struct compat_robust_list_head;
+struct futex_pi_state;
+struct robust_list_head;
+
+/**
+ * struct futex_ctrl - Futex related per task data
maybe futex_task_data to match futex_mm_data?
+ * @robust_list: User space registered robust list pointer
+ * @compat_robust_list: User space registered robust list pointer for compat tasks
to avoid kernel-doc warnings:
@pi_state_list: List of PI mutexes holded by this task
@pi_state_cache: Copy of the PI state
+ * @exit_mutex: Mutex for serializing exit
+ * @state: Futex handling state to handle exit races correctly
+ */
+struct futex_ctrl {
+ struct robust_list_head __user *robust_list;
+#ifdef CONFIG_COMPAT
+ struct compat_robust_list_head __user *compat_robust_list;
+#endif
+ struct list_head pi_state_list;
+ struct futex_pi_state *pi_state_cache;
+ struct mutex exit_mutex;
+ unsigned int state;
+};