Re: [PATCH]cpuset: add new API to change cpuset top group's cpus

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

 



On Tue, May 19, 2009 at 12:39 AM, Shaohua Li <shaohua.li@xxxxxxxxx> wrote:
>
> This patch adds one API to change cpuset top group's cpus. If we want to
> make one cpu idle, simply remove the cpu from cpuset top group's cpu list,
> then all tasks will be migrate to other cpus, and other tasks will not be
> migrated to this cpu again. No functional changes.

>
> +int cpuset_change_top_cpumask(const char *buf)
> +{
> +       int retval = 0;
> +       struct cpuset *cs = &top_cpuset;
> +       struct cpuset *trialcs;
> +
> +       if (!cgroup_lock_live_group(cs->css.cgroup))
> +               return -ENODEV;

top_cpuset can't possibly be dead, so a plain cgroup_lock() would be fine here.

> +
> +       trialcs = alloc_trial_cpuset(cs);
> +       if (!trialcs)
> +               return -ENOMEM;

You returned without doing a cgroup_unlock()

> +
> +       retval = update_cpumask(cs, trialcs, buf, true);

This will fail if any child cpuset is using any cpu not in the new
cpumask, since a child's cpumask must be a subset of its parent's.

So this can't work without co-ordination with userspace regarding
child cpusets. Given that, it seems simpler to do the whole thing in
userspace, or just use the existing hotplug infrastructure.

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

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux