diff options
author | Dave Martin <Dave.Martin@arm.com> | 2018-04-11 12:54:20 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2018-05-25 07:27:53 -0400 |
commit | 93ee37c2a6a97e5d358af2d8f0510817b6e75679 (patch) | |
tree | 25ac1eba47eb4b98989c766bc3ea7383cc5e933a /include/linux/sched.h | |
parent | d8ad71fa38a96128ebb0462539fee6cb9391d17b (diff) |
thread_info: Add update_thread_flag() helpers
There are a number of bits of code sprinkled around the kernel to
set a thread flag if a certain condition is true, and clear it
otherwise.
To help make those call sites terser and less cumbersome, this
patch adds a new family of thread flag manipulators
update*_thread_flag([...,] flag, cond)
which do the equivalent of:
if (cond)
set*_thread_flag([...,] flag);
else
clear*_thread_flag([...,] flag);
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index b3d697f3b573..c2c305199721 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1578,6 +1578,12 @@ static inline void clear_tsk_thread_flag(struct task_struct *tsk, int flag) | |||
1578 | clear_ti_thread_flag(task_thread_info(tsk), flag); | 1578 | clear_ti_thread_flag(task_thread_info(tsk), flag); |
1579 | } | 1579 | } |
1580 | 1580 | ||
1581 | static inline void update_tsk_thread_flag(struct task_struct *tsk, int flag, | ||
1582 | bool value) | ||
1583 | { | ||
1584 | update_ti_thread_flag(task_thread_info(tsk), flag, value); | ||
1585 | } | ||
1586 | |||
1581 | static inline int test_and_set_tsk_thread_flag(struct task_struct *tsk, int flag) | 1587 | static inline int test_and_set_tsk_thread_flag(struct task_struct *tsk, int flag) |
1582 | { | 1588 | { |
1583 | return test_and_set_ti_thread_flag(task_thread_info(tsk), flag); | 1589 | return test_and_set_ti_thread_flag(task_thread_info(tsk), flag); |