[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6599ad830905191255r13b6166fs105213faf30f229f@mail.gmail.com>
Date: Tue, 19 May 2009 12:55:18 -0700
From: Paul Menage <menage@...gle.com>
To: Shaohua Li <shaohua.li@...el.com>
Cc: linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
lenb@...nel.org
Subject: Re: [PATCH]cpuset: add new API to change cpuset top group's cpus
On Tue, May 19, 2009 at 12:39 AM, Shaohua Li <shaohua.li@...el.com> 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists