From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967653AbdEZIu1 (ORCPT ); Fri, 26 May 2017 04:50:27 -0400 Received: from terminus.zytor.com ([65.50.211.136]:56153 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967198AbdEZIuZ (ORCPT ); Fri, 26 May 2017 04:50:25 -0400 Date: Fri, 26 May 2017 01:47:52 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: rostedt@goodmis.org, tglx@linutronix.de, bigeasy@linutronix.de, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com Reply-To: rostedt@goodmis.org, tglx@linutronix.de, hpa@zytor.com, bigeasy@linutronix.de, paulmck@linux.vnet.ibm.com, mingo@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org In-Reply-To: <20170524081549.541649540@linutronix.de> References: <20170524081549.541649540@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] sched: Provide is_percpu_thread() helper Git-Commit-ID: 62ec05dd71b19f5be890a1992227cc7b2ac0adc4 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 62ec05dd71b19f5be890a1992227cc7b2ac0adc4 Gitweb: http://git.kernel.org/tip/62ec05dd71b19f5be890a1992227cc7b2ac0adc4 Author: Thomas Gleixner AuthorDate: Wed, 24 May 2017 10:15:41 +0200 Committer: Thomas Gleixner 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 Tested-by: Paul E. McKenney Acked-by: Ingo Molnar Cc: Peter Zijlstra Cc: Sebastian Siewior Cc: Steven Rostedt 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 */