Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964809AbbDJPdc (ORCPT ); Fri, 10 Apr 2015 11:33:32 -0400 Received: from mail-am1on0070.outbound.protection.outlook.com ([157.56.112.70]:21624 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933202AbbDJPda (ORCPT ); Fri, 10 Apr 2015 11:33:30 -0400 Message-ID: <5527ED3E.1060101@ezchip.com> Date: Fri, 10 Apr 2015 11:33:18 -0400 From: Chris Metcalf User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Mike Galbraith , Peter Zijlstra CC: Frederic Weisbecker , "Paul E. McKenney" , "Rafael J. Wysocki" , Martin Schwidefsky , Ingo Molnar , Subject: Re: [PATCH v5] nohz: set isolcpus when nohz_full is set References: <20150409124524.GA17709@lerouge> <1428598779-24244-1-git-send-email-cmetcalf@ezchip.com> <20150409171251.GS21418@twins.programming.kicks-ass.net> <1428627910.3203.4.camel@gmail.com> In-Reply-To: <1428627910.3203.4.camel@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: BN3PR09CA0040.namprd09.prod.outlook.com (25.160.111.178) To DB5PR02MB0773.eurprd02.prod.outlook.com (25.161.243.144) Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB0773; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1;SFV:NSPM;SFS:(10009020)(6049001)(6009001)(24454002)(377424004)(377454003)(51704005)(479174004)(83506001)(23676002)(575784001)(86362001)(77156002)(62966003)(36756003)(2950100001)(92566002)(87976001)(59896002)(54356999)(46102003)(76176999)(87266999)(122386002)(50986999)(65816999)(50466002)(47776003)(93886004)(33656002)(66066001)(65956001)(42186005)(19580395003)(64126003)(77096005)(80316001)(15975445007)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR02MB0773;H:[10.7.0.41];FPR:;SPF:None;MLV:sfv;LANG:en; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:DB5PR02MB0773;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB0773; X-Forefront-PRVS: 054231DC40 X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2015 15:33:26.8879 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR02MB0773 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3094 Lines: 75 On 04/09/2015 09:05 PM, Mike Galbraith wrote: > On Thu, 2015-04-09 at 19:12 +0200, Peter Zijlstra wrote: >> On Thu, Apr 09, 2015 at 12:59:39PM -0400, Chris Metcalf wrote: >>> diff --git a/include/linux/sched.h b/include/linux/sched.h >>> index 6d77432e14ff..18a961b9beba 100644 >>> --- a/include/linux/sched.h >>> +++ b/include/linux/sched.h >>> @@ -323,6 +323,7 @@ struct task_struct; >>> extern int lockdep_tasklist_lock_is_held(void); >>> #endif /* #ifdef CONFIG_PROVE_RCU */ >>> >>> +extern void sched_isolated_map_add(const struct cpumask *); >>> extern void sched_init(void); >>> extern void sched_init_smp(void); >>> extern asmlinkage void schedule_tail(struct task_struct *prev); >>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c >>> index f0f831e8a345..b055c5e0e65c 100644 >>> --- a/kernel/sched/core.c >>> +++ b/kernel/sched/core.c >>> @@ -5824,6 +5824,11 @@ static int __init isolated_cpu_setup(char >>> *str) >>> >>> __setup("isolcpus=", isolated_cpu_setup); >>> >>> +void sched_isolated_map_add(const struct cpumask *cpumask) >>> +{ >>> + cpumask_or(cpu_isolated_map, cpu_isolated_map, cpumask); >>> +} >>> + >>> struct s_data { >>> struct sched_domain ** __percpu sd; >>> struct root_domain *rd; >>> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c >>> index a4c4edac4528..b0092d02ca3f 100644 >>> --- a/kernel/time/tick-sched.c >>> +++ b/kernel/time/tick-sched.c >>> @@ -385,6 +385,9 @@ void __init tick_nohz_init(void) >>> for_each_cpu(cpu, tick_nohz_full_mask) >>> context_tracking_cpu_set(cpu); >>> >>> + /* It's not meaningful to be nohz without disabling the >>> scheduler. */ >>> + sched_isolated_map_add(tick_nohz_full_mask); >>> + >>> cpu_notifier(tick_nohz_cpu_down_callback, 0); >>> pr_info("NO_HZ: Full dynticks CPUs: %*pbl.\n", >>> cpumask_pr_args(tick_nohz_full_mask)); >> Right, this could work. Although I would suggest adding a comment >> somewhere that we should be careful with init order. I checked, this >> appears to be ordered right, but... > I'd embed it in domain construction, that way it'd be ready for the > day nohz_full becomes dynamic, and people can start using cpusets to > set up /tear down isolated sets on the fly. So, move it to the top of build_sched_domains(), and then for every "const struct cpumask *cpu_map" argument, create a temporary cpu_map so we can mask out the nohz_full cores? The problem is, we already allow partition_sched_domains() to override "isolcpus=", so it seems appropriate that you should be able to override "nohz_full=" in the same way, which my current patch (v6) does. So I think the proposed solution is certainly no worse than what we have now in terms of a future migration to cpusets. -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/