Re: [PATCH v10 2/3] watchdog: add watchdog_cpumask sysctl to assist nohz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 30, 2015 at 03:39:25PM -0400, Chris Metcalf wrote:
> Change the default behavior of watchdog so it only runs on the
> housekeeping cores when nohz_full is enabled at build and boot time.
> Allow modifying the set of cores the watchdog is currently running
> on with a new kernel.watchdog_cpumask sysctl.
> 
> In the current system, the watchdog subsystem runs a periodic timer
> that schedules the watchdog kthread to run.  However, nohz_full cores
> are designed to allow userspace application code running on those cores
> to have 100% access to the CPU.  So the watchdog system prevents the
> nohz_full application code from being able to run the way it wants to,
> thus the motivation to suppress the watchdog on nohz_full cores,
> which this patchset provides by default.
> 
> However, if we disable the watchdog globally, then the housekeeping
> cores can't benefit from the watchdog functionality.  So we allow
> disabling it only on some cores.  See Documentation/lockup-watchdogs.txt
> for more information.
> 
> Acked-by: Don Zickus <dzickus@xxxxxxxxxx>
> Signed-off-by: Chris Metcalf <cmetcalf@xxxxxxxxxx>
> ---
>  Documentation/lockup-watchdogs.txt | 18 +++++++++++
>  Documentation/sysctl/kernel.txt    | 21 +++++++++++++
>  include/linux/nmi.h                |  3 ++
>  kernel/sysctl.c                    |  7 +++++
>  kernel/watchdog.c                  | 64 +++++++++++++++++++++++++++++++++++---
>  5 files changed, 108 insertions(+), 5 deletions(-)
>

<snip>
 
> @@ -697,8 +704,12 @@ static int watchdog_enable_all_cpus(void)
>  		err = smpboot_register_percpu_thread(&watchdog_threads);
>  		if (err)
>  			pr_err("Failed to create watchdog threads, disabled\n");
> -		else
> +		else {
> +			if (smpboot_update_cpumask_percpu_thread(
> +				    &watchdog_threads, &watchdog_cpumask))
> +				pr_err("Failed to set cpumask for watchdog threads\n");

Stupid nitpick, this error message tells us the 'watchdog' threads caused
the cpumask failure, but ....

>  			watchdog_running = 1;
> +		}
>  	} else {
>  		/*
>  		 * Enable/disable the lockup detectors or
> @@ -869,12 +880,55 @@ out:
>  	mutex_unlock(&watchdog_proc_mutex);
>  	return err;
>  }
> +
> +/*
> + * 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) {
> +			/*
> +			 * Failure would be due to being unable to allocate
> +			 * a temporary cpumask, so we are likely not in a
> +			 * position to do much else to make things better.
> +			 */
> +			if (smpboot_update_cpumask_percpu_thread(
> +				    &watchdog_threads, &watchdog_cpumask) != 0)
> +				pr_err("cpumask update failed\n");

This one does not. :-(  If there is a respin, I would suggest copying the
above message down here. 


Cheers,
Don
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux