Re: [PATCH v2] CPU hotplug, freezer: Fix bugs in CPU hotplug call path

From: AmÃrico Wang
Date: Sat Oct 08 2011 - 08:57:09 EST


On Sat, Oct 8, 2011 at 4:56 AM, Srivatsa S. Bhat
<srivatsa.bhat@xxxxxxxxxxxxxxxxxx> wrote:
> diff --git a/include/linux/freezer.h b/include/linux/freezer.h
> index 1effc8b..75c65d6 100644
> --- a/include/linux/freezer.h
> +++ b/include/linux/freezer.h
> @@ -7,6 +7,9 @@
> Â#include <linux/wait.h>
>
> Â#ifdef CONFIG_FREEZER
> +
> +extern struct mutex freezer_lock;
> +
[...]
> Âstatic inline int try_to_freeze(void)
> Â{
> Â Â Â Âif (freezing(current)) {
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 12b7458..b94c8f6 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -15,6 +15,7 @@
> Â#include <linux/stop_machine.h>
> Â#include <linux/mutex.h>
> Â#include <linux/gfp.h>
> +#include <linux/freezer.h>
>
> Â#ifdef CONFIG_SMP
> Â/* Serializes the updates to cpu_online_mask, cpu_present_mask */
> @@ -280,7 +281,9 @@ int __ref cpu_down(unsigned int cpu)
> Â Â Â Â Â Â Â Âgoto out;
> Â Â Â Â}
>
> - Â Â Â err = _cpu_down(cpu, 0);
> + Â Â Â mutex_lock(&freezer_lock);
> + Â Â Â err = _cpu_down(cpu, tasks_are_frozen());
> + Â Â Â mutex_unlock(&freezer_lock);
>

Can this even be compiled when CONFIG_FREEZER=n?
--
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/