linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Menage <menage@google.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	lenb@kernel.org
Subject: Re: [PATCH]cpuset: add new API to change cpuset top group's cpus
Date: Tue, 19 May 2009 12:55:18 -0700	[thread overview]
Message-ID: <6599ad830905191255r13b6166fs105213faf30f229f@mail.gmail.com> (raw)
In-Reply-To: <20090519073942.GA10864@sli10-desk.sh.intel.com>

On Tue, May 19, 2009 at 12:39 AM, Shaohua Li <shaohua.li@intel.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

      parent reply	other threads:[~2009-05-19 19:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19  7:39 [PATCH]cpuset: add new API to change cpuset top group's cpus Shaohua Li
2009-05-19  8:40 ` Peter Zijlstra
2009-05-19  8:48   ` Shaohua Li
2009-05-19  8:56     ` Peter Zijlstra
2009-05-19  9:06       ` Shaohua Li
2009-05-19  9:31         ` Peter Zijlstra
2009-05-19 10:38       ` Peter Zijlstra
2009-05-19 13:37         ` Vaidyanathan Srinivasan
2009-05-28  2:34           ` Len Brown
2009-05-28  7:44             ` Vaidyanathan Srinivasan
2009-05-19 19:01         ` Len Brown
2009-05-19 22:36           ` Peter Zijlstra
2009-05-20 11:58             ` Andi Kleen
2009-05-20 12:17               ` Peter Zijlstra
2009-05-20 13:13                 ` Andi Kleen
2009-05-20 13:41                   ` Peter Zijlstra
2009-05-20 14:45                     ` Andi Kleen
2009-05-20 17:36                     ` Vaidyanathan Srinivasan
2009-05-21  1:22                       ` Shaohua Li
2009-05-21  3:20                         ` Vaidyanathan Srinivasan
2009-05-20 17:21           ` Vaidyanathan Srinivasan
2009-05-19 11:27   ` Andi Kleen
2009-05-19 12:01     ` Peter Zijlstra
2009-05-19 19:55 ` Paul Menage [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6599ad830905191255r13b6166fs105213faf30f229f@mail.gmail.com \
    --to=menage@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaohua.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).