On Fri, 20 Dec 2013 22:44:13 +0100
Peter Zijlstra <pet...@infradead.org> wrote:


> @@ -5056,10 +5018,28 @@ static int sched_cpu_inactive(struct not
>       switch (action & ~CPU_TASKS_FROZEN) {
>       case CPU_DOWN_PREPARE:
>               set_cpu_active((long)hcpu, false);
> -             return NOTIFY_OK;
> -     default:
> -             return NOTIFY_DONE;
> +             break;
>       }
> +
> +     switch (action) {
> +     case CPU_DOWN_PREPARE: /* explicitly allow suspend */

Instead of the double switch (which is quite confusing), what about
just adding:

        if (!(action & CPU_TASKS_FROZEN))

I mean, the above switch gets called for both cases, this only gets
called for the one case. This case is a subset of the above. I don't
see why an if () would not be better than a double (confusing) switch().

Also, it seems that this change also does not return NOTIFY_DONE if
something other than CPU_DOWN_PREPARE is passed in.

-- Steve

> +             {
> +                     struct dl_bw *dl_b = dl_bw_of(cpu);
> +                     bool overflow;
> +                     int cpus;
> +
> +                     raw_spin_lock_irqsave(&dl_b->lock, flags);
> +                     cpus = dl_bw_cpus(cpu);
> +                     overflow = __dl_overflow(dl_b, cpus, 0, 0);
> +                     raw_spin_unlock_irqrestore(&dl_b->lock, flags);
> +
> +                     if (overflow)
> +                             return notifier_from_errno(-EBUSY);
> +             }
> +             break;
> +     }
> +
> +     return NOTIFY_OK;
>  }
>  
>  static int __init migration_init(void)

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

Reply via email to