[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1507552234.376854259@decadent.org.uk>
Date: Mon, 09 Oct 2017 13:30:34 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, "Ingo Molnar" <mingo@...nel.org>,
"Kees Cook" <keescook@...omium.org>, "Tejun Heo" <tj@...nel.org>,
"Zefan Li" <lizefan@...wei.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
"Miao Xie" <miaox@...fujitsu.com>,
"Tetsuo Handa" <penguin-kernel@...ove.SAKURA.ne.jp>
Subject: [PATCH 3.2 73/74] sched: add macros to define bitops for task
atomic flags
3.2.94-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Zefan Li <lizefan@...wei.com>
commit e0e5070b20e01f0321f97db4e4e174f3f6b49e50 upstream.
This will simplify code when we add new flags.
v3:
- Kees pointed out that no_new_privs should never be cleared, so we
shouldn't define task_clear_no_new_privs(). we define 3 macros instead
of a single one.
v2:
- updated scripts/tags.sh, suggested by Peter
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Miao Xie <miaox@...fujitsu.com>
Cc: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Acked-by: Kees Cook <keescook@...omium.org>
Signed-off-by: Zefan Li <lizefan@...wei.com>
Signed-off-by: Tejun Heo <tj@...nel.org>
[lizf: Backported to 3.4:
- adjust context
- remove no_new_priv code
- add atomic_flags to struct task_struct]
[bwh: Backported to 3.2:
- Drop changes in scripts/tags.sh
- Adjust context]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1313,6 +1313,8 @@ struct task_struct {
unsigned sched_reset_on_fork:1;
unsigned sched_contributes_to_load:1;
+ unsigned long atomic_flags; /* Flags needing atomic access. */
+
pid_t pid;
pid_t tgid;
@@ -1844,6 +1846,18 @@ extern void thread_group_times(struct ta
#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
#define used_math() tsk_used_math(current)
+/* Per-process atomic flags. */
+
+#define TASK_PFA_TEST(name, func) \
+ static inline bool task_##func(struct task_struct *p) \
+ { return test_bit(PFA_##name, &p->atomic_flags); }
+#define TASK_PFA_SET(name, func) \
+ static inline void task_set_##func(struct task_struct *p) \
+ { set_bit(PFA_##name, &p->atomic_flags); }
+#define TASK_PFA_CLEAR(name, func) \
+ static inline void task_clear_##func(struct task_struct *p) \
+ { clear_bit(PFA_##name, &p->atomic_flags); }
+
/*
* task->jobctl flags
*/
Powered by blists - more mailing lists