Re: [PATCH 3/4] watchdog: disable watchdog when thresh is zero

From: Ingo Molnar
Date: Tue May 17 2011 - 03:10:32 EST



* Mandeep Singh Baines <msb@xxxxxxxxxxxx> wrote:

> This restores the previous behavior of softlock_thresh.
>
> Currently, setting watchdog_thresh to zero causes the watchdog
> kthreads to consume a lot of CPU.
>
> Signed-off-by: Mandeep Singh Baines <msb@xxxxxxxxxxxx>
> Cc: Marcin Slusarz <marcin.slusarz@xxxxxxxxx>
> Cc: Don Zickus <dzickus@xxxxxxxxxx>
> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> ---
> kernel/watchdog.c | 15 ++++++++++++++-
> 1 files changed, 14 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> index cf0e09f..50c2f62 100644
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -526,7 +526,20 @@ int proc_dowatchdog_thresh(struct ctl_table *table, int write,
> void __user *buffer,
> size_t *lenp, loff_t *ppos)
> {
> - return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
> + int ret;
> +
> + ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
> + if (ret || !write)
> + goto out;
> +
> + if (softlockup_thresh)
> + watchdog_enable_all_cpus();
> + else
> + watchdog_disable_all_cpus();

This now adds two similar looking blocks of these 4 lines, one in
proc_dowatchdog_enabled(), one in proc_dowatchdog_thresh().

They are not the same though. So what happens if the watchdog is disabled but
the threshold is updated to nonzero - do we enable the watchdog?

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/