From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756785AbbDJUyF (ORCPT ); Fri, 10 Apr 2015 16:54:05 -0400 Received: from mail-db3on0090.outbound.protection.outlook.com ([157.55.234.90]:54176 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755995AbbDJUyB (ORCPT ); Fri, 10 Apr 2015 16:54:01 -0400 Authentication-Results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; ezchip.com; dkim=none (message not signed) header.d=none; From: Chris Metcalf To: "Peter Zijlstra (Intel)" , Frederic Weisbecker , "Paul E. McKenney" , "Rafael J. Wysocki" , Martin Schwidefsky , Ingo Molnar , CC: Chris Metcalf Subject: [PATCH v7 1/2] nohz: add tick_nohz_full_add_cpus_to() and _remove_cpus_from() APIs Date: Fri, 10 Apr 2015 16:53:51 -0400 Message-ID: <1428699232-7940-1-git-send-email-cmetcalf@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <20150410013702.GF18314@lerouge> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:12.216.194.146;CTRY:US;IPV:NLI;EFV:NLI;BMV:1;SFV:NSPM;SFS:(10009020)(6009001)(339900001)(199003)(189002)(19580405001)(229853001)(2950100001)(6806004)(50226001)(575784001)(50986999)(106466001)(50466002)(92566002)(48376002)(87936001)(36756003)(46102003)(33646002)(105606002)(85426001)(19580395003)(77156002)(47776003)(42186005)(62966003)(86362001)(104016003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR02MB0784;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB0784; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5002010)(5005006);SRVR:VI1PR02MB0784;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB0784; X-Forefront-PRVS: 054231DC40 X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2015 20:53:57.5418 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3;Ip=[12.216.194.146];Helo=[ld-1.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB0784 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "removes_cpus_from" API is useful, for example, to modify a cpumask to avoid the nohz cores so that interrupts aren't sent to them. Likewise the "add_cpus_to" API is useful to modify a cpumask indicating some special nohz-type functionality so that the nohz cores are automatically added to that set. Signed-off-by: Chris Metcalf --- v7: no change here, just in part 2/2. v6: I think we may finally have accessor names that are OK v5: (skipped this patch) v4: update accessor names to make them clearer [PeterZ] v3: no change here, just in part 2/2. v2: put the "...set_cpus" API together with the change to init_sched_domains() so that they can go into the timer tree independently of other changes in my tree. include/linux/tick.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) include/linux/tick.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/tick.h b/include/linux/tick.h index 9c085dc12ae9..8d1754c0f694 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -186,6 +186,18 @@ static inline bool tick_nohz_full_cpu(int cpu) return cpumask_test_cpu(cpu, tick_nohz_full_mask); } +static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) +{ + if (tick_nohz_full_enabled()) + cpumask_or(mask, mask, tick_nohz_full_mask); +} + +static inline void tick_nohz_full_remove_cpus_from(struct cpumask *mask) +{ + if (tick_nohz_full_enabled()) + cpumask_andnot(mask, mask, tick_nohz_full_mask); +} + extern void __tick_nohz_full_check(void); extern void tick_nohz_full_kick(void); extern void tick_nohz_full_kick_cpu(int cpu); @@ -194,6 +206,8 @@ extern void __tick_nohz_task_switch(struct task_struct *tsk); #else static inline bool tick_nohz_full_enabled(void) { return false; } static inline bool tick_nohz_full_cpu(int cpu) { return false; } +static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { } +static inline void tick_nohz_full_remove_cpus_from(struct cpumask *mask) { } static inline void __tick_nohz_full_check(void) { } static inline void tick_nohz_full_kick_cpu(int cpu) { } static inline void tick_nohz_full_kick(void) { } -- 2.1.2