Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933129AbbDQQKg (ORCPT ); Fri, 17 Apr 2015 12:10:36 -0400 Received: from mail-db3on0053.outbound.protection.outlook.com ([157.55.234.53]:22497 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932402AbbDQQKf (ORCPT ); Fri, 17 Apr 2015 12:10:35 -0400 Authentication-Results: infradead.org; dkim=none (message not signed) header.d=none; Message-ID: <55313067.5070108@ezchip.com> Date: Fri, 17 Apr 2015 12:10:15 -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: Chai Wen CC: Frederic Weisbecker , Don Zickus , Ingo Molnar , Andrew Morton , Andrew Jones , Ulrich Obergfell , Fabian Frederick , Aaron Tomlin , Ben Zhang , Christoph Lameter , Gilad Ben-Yossef , Steven Rostedt , , Jonathan Corbet , , Thomas Gleixner , Peter Zijlstra Subject: Re: [PATCH v8 2/3] watchdog: add watchdog_cpumask sysctl to assist nohz References: <20150413215423.GA6121@lerouge> <1429040253-7054-1-git-send-email-cmetcalf@ezchip.com> <1429040253-7054-2-git-send-email-cmetcalf@ezchip.com> <5530626B.5040103@cn.fujitsu.com> In-Reply-To: <5530626B.5040103@cn.fujitsu.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: BY1PR0201CA0029.namprd02.prod.outlook.com (25.160.191.167) To DB5PR02MB0773.eurprd02.prod.outlook.com (25.161.243.144) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB0773; X-Forefront-Antispam-Report: BMV:1;SFV:NSPM;SFS:(10009020)(6009001)(6049001)(24454002)(377454003)(479174004)(41574002)(51704005)(23676002)(36756003)(4001350100001)(40100003)(66066001)(42186005)(65806001)(47776003)(86362001)(122386002)(65956001)(62966003)(92566002)(46102003)(77156002)(117636001)(15975445007)(50466002)(2950100001)(87976001)(19580395003)(83506001)(110136001)(99136001)(64126003)(87266999)(76176999)(50986999)(77096005)(65816999)(93886004)(54356999)(62816006)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR02MB0773;H:[10.7.0.41];FPR:;SPF:None;MLV:sfv;LANG:en; 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:DB5PR02MB0773;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB0773; X-Forefront-PRVS: 0549E6FD50 X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2015 16:10:27.3577 (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: 2278 Lines: 66 On 04/16/2015 09:31 PM, Chai Wen wrote: > On 04/15/2015 03:37 AM, Chris Metcalf wrote: >> +/* >> + * The cpumask is the mask of possible cpus that the watchdog can run >> + * on, not the mask of cpus it is actually running on. This allows the >> + * user to specify a mask that will include cpus that have not yet >> + * been brought online, if desired. >> + */ >> +int proc_watchdog_cpumask(struct ctl_table *table, int write, >> + void __user *buffer, size_t *lenp, loff_t *ppos) >> +{ >> + int err; >> + >> + mutex_lock(&watchdog_proc_mutex); >> + err = proc_do_large_bitmap(table, write, buffer, lenp, ppos); >> + if (!err && write) { >> + /* Remove impossible cpus to keep sysctl output cleaner. */ >> + cpumask_and(watchdog_cpumask, watchdog_cpumask, >> + cpu_possible_mask); >> + >> + if (watchdog_enabled && watchdog_thresh) > > If the new mask is same as the current one, then there is no need to go on ? > cpus_equal(watchdog_cpumask, watchdog_cpumask_for_smpboot) or something else ? It's a minor optimization, though, since the smpboot_update_cpumask_percpu_thread() function will do some cpumask calls and realize that nothing has changed and return without doing anything anyway. In any case, with Frederic's recent suggstion, we won't have a watchdog_cpumask_for_smpboot variable exposed anyway. >> + smpboot_update_cpumask_percpu_thread(&watchdog_threads, >> + watchdog_cpumask); >> + } >> + mutex_unlock(&watchdog_proc_mutex); >> + return err; >> +} >> + >> #endif /* CONFIG_SYSCTL */ >> >> void __init lockup_detector_init(void) >> { >> set_sample_period(); >> >> + /* One cpumask is allocated for smpboot to own. */ >> + alloc_cpumask_var(&watchdog_cpumask_for_smpboot, GFP_KERNEL); > > alloc_cpumask_var could fail? Good catch; if I get a failure I'll just return early without trying to start the watchdog, since clearly things are too memory-constrained to enable that functionality anyway. Thanks! -- 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/