Skip to content

Commit 62ec05d

Browse files
committed
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]
1 parent fc8dffd commit 62ec05d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/linux/sched.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,16 @@ extern struct pid *cad_pid;
12651265
#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
12661266
#define used_math() tsk_used_math(current)
12671267

1268+
static inline bool is_percpu_thread(void)
1269+
{
1270+
#ifdef CONFIG_SMP
1271+
return (current->flags & PF_NO_SETAFFINITY) &&
1272+
(current->nr_cpus_allowed == 1);
1273+
#else
1274+
return true;
1275+
#endif
1276+
}
1277+
12681278
/* Per-process atomic flags. */
12691279
#define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */
12701280
#define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */

0 commit comments

Comments
 (0)