Re: [PATCH v3] watchdog: add watchdog_cpumask sysctl to assist nohz

Peter Zijlstra
2015-04-02T18:33:25Z

On Thu, Apr 02, 2015 at 02:16:09PM -0400, Chris Metcalf wrote:
> On 04/02/2015 02:06 PM, Peter Zijlstra wrote:
> >On Thu, Apr 02, 2015 at 01:39:28PM -0400, cmetcalf@ezchip.com wrote:
> >>@@ -431,6 +434,10 @@ static void watchdog_enable(unsigned int cpu)
> >> hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> >> hrtimer->function = watchdog_timer_fn;
> >>+ /* Exit if the cpu is not allowed for watchdog. */
> >>+ if (!cpumask_test_cpu(cpu, watchdog_mask))
> >>+ do_exit(0);
> >>+
> >Ick, that doesn't look right for smpboot threads.
>
> I didn't see a better way to make this happen without adding
> a bunch of infrastructure to the smpboot thread mechanism
> to use a cpumask other than for_each_online_cpu(). The exit
> seems benign in my testing, but I agree it's not the cleanest
> way to express what we're trying to do here.
>
> Perhaps something like an optional cpumask_t pointer in
> struct smp_hotplug_thread, which if present specifies the
> cpus to run on, and otherwise we stick with cpu_online_mask?

What's wrong with just leaving the thread be but making sure it'll never
actually do anything?