Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1651238 > unrolled thread
| Started by | tip-bot for Thomas Gleixner <tipbot@zytor.com> |
|---|---|
| First post | 2017-05-26 11:00 +0200 |
| Last post | 2017-05-26 11:00 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[tip:smp/hotplug] sched: Provide is_percpu_thread() helper tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-05-26 11:00 +0200
| From | tip-bot for Thomas Gleixner <tipbot@zytor.com> |
|---|---|
| Date | 2017-05-26 11:00 +0200 |
| Subject | [tip:smp/hotplug] sched: Provide is_percpu_thread() helper |
| Message-ID | <tLjge-3FP-17@gated-at.bofh.it> |
Commit-ID: 62ec05dd71b19f5be890a1992227cc7b2ac0adc4
Gitweb: http://git.kernel.org/tip/62ec05dd71b19f5be890a1992227cc7b2ac0adc4
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 24 May 2017 10:15:41 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 26 May 2017 10:10:47 +0200
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 <tglx@linutronix.de>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170524081549.541649540@linutronix.de
---
include/linux/sched.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2b69fc6..3dfa5f9 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 */
Back to top | Article view | linux.kernel
csiph-web