diff options
author | Thomas Gleixner <[email protected]> | 2017-05-24 10:15:41 +0200 |
---|---|---|
committer | Thomas Gleixner <[email protected]> | 2017-05-26 10:10:47 +0200 |
commit | 62ec05dd71b19f5be890a1992227cc7b2ac0adc4 (patch) | |
tree | 926661715ed8f2f6affb210d68b5c00cb39e42aa | |
parent | fc8dffd379ca5620664336eb895a426b42847558 (diff) |
sched: Provide is_percpu_thread() helper
Provide a helper function for checking whether current task is a per cpu
thread.
Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Paul E. McKenney <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sebastian Siewior <[email protected]>
Cc: Steven Rostedt <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
-rw-r--r-- | include/linux/sched.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 2b69fc650201..3dfa5f99d6ee 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1265,6 +1265,16 @@ extern struct pid *cad_pid; #define tsk_used_math(p) ((p)->flags & PF_USED_MATH) #define used_math() tsk_used_math(current) +static inline bool is_percpu_thread(void) +{ +#ifdef CONFIG_SMP + return (current->flags & PF_NO_SETAFFINITY) && + (current->nr_cpus_allowed == 1); +#else + return true; +#endif +} + /* Per-process atomic flags. */ #define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */ #define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */ |