[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55313067.5070108@ezchip.com>
Date: Fri, 17 Apr 2015 12:10:15 -0400
From: Chris Metcalf <cmetcalf@...hip.com>
To: Chai Wen <chaiw.fnst@...fujitsu.com>
CC: Frederic Weisbecker <fweisbec@...il.com>,
Don Zickus <dzickus@...hat.com>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrew Jones <drjones@...hat.com>,
Ulrich Obergfell <uobergfe@...hat.com>,
Fabian Frederick <fabf@...net.be>,
Aaron Tomlin <atomlin@...hat.com>,
Ben Zhang <benzh@...omium.org>,
Christoph Lameter <cl@...ux.com>,
Gilad Ben-Yossef <gilad@...yossef.com>,
Steven Rostedt <rostedt@...dmis.org>,
<linux-kernel@...r.kernel.org>, Jonathan Corbet <corbet@....net>,
<linux-doc@...r.kernel.org>, Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v8 2/3] watchdog: add watchdog_cpumask sysctl to assist
nohz
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists