From: Dinakar Guniguntala <dino@in.ibm.com>
To: Paul Jackson <pj@sgi.com>
Cc: Simon.Derr@bull.net, nickpiggin@yahoo.com.au,
linux-kernel@vger.kernel.org, lse-tech@lists.sourceforge.net,
akpm@osdl.org, dipankar@in.ibm.com, colpatch@us.ibm.com
Subject: Re: [Lse-tech] Re: [RFC PATCH] Dynamic sched domains aka Isolated cpusets
Date: Sat, 23 Apr 2005 12:54:24 +0530 [thread overview]
Message-ID: <20050423072424.GA3929@in.ibm.com> (raw)
In-Reply-To: <20050422142618.08d74ede.pj@sgi.com>
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
On Fri, Apr 22, 2005 at 02:26:18PM -0700, Paul Jackson wrote:
> 3) Extend the exclusive capability to include isolation from parents,
> along the lines of your patch.
This was precisely the design that I first came up not so long ago, but
never posted. The reason being that I thought all parties involved had
already agreed to this design because of some reason (unknown to me)
that was already discussed in detail during the last flurry of emails.
Now that you have asked this question and actually said that this would
probably be a better design, I wholeheartedly agree and whats more
I already have most of the code required. Infact here it is
I think I'll redo the patch and post it for review shortly
-Dinakar
(Warning, this has all the warts that have previosuly been pointed
out and more)
[-- Attachment #2: sd-cpuset-v1-mail.patch --]
[-- Type: text/plain, Size: 4890 bytes --]
diff -Naurp linux-2.6.12-rc1-mm1.orig/kernel/cpuset.c linux-2.6.12-rc1-mm1/kernel/cpuset.c
--- linux-2.6.12-rc1-mm1.orig/kernel/cpuset.c 2005-04-13 14:42:36.000000000 +0530
+++ linux-2.6.12-rc1-mm1/kernel/cpuset.c 2005-04-13 21:18:26.876673392 +0530
@@ -58,6 +58,7 @@
struct cpuset {
unsigned long flags; /* "unsigned long" so bitops work */
cpumask_t cpus_allowed; /* CPUs allowed to tasks in cpuset */
+ cpumask_t domain_span; /* CPUs associated with a sched domain */
nodemask_t mems_allowed; /* Memory Nodes allowed to tasks */
atomic_t count; /* count tasks using this cpuset */
@@ -129,6 +130,7 @@ static atomic_t cpuset_mems_generation =
static struct cpuset top_cpuset = {
.flags = ((1 << CS_CPU_EXCLUSIVE) | (1 << CS_MEM_EXCLUSIVE)),
.cpus_allowed = CPU_MASK_ALL,
+ .domain_span = CPU_MASK_ALL,
.mems_allowed = NODE_MASK_ALL,
.count = ATOMIC_INIT(0),
.sibling = LIST_HEAD_INIT(top_cpuset.sibling),
@@ -602,6 +604,60 @@ static int validate_change(const struct
return 0;
}
+static void rebuild_domains(cpumask_t change_map, struct cpuset *cs)
+{
+ struct cpuset *parent = cs->parent;
+
+ lock_cpu_hotplug();
+ detach_domains(change_map);
+ if (!cpus_empty(parent->domain_span))
+ build_sched_domains(parent->domain_span);
+ if (cpus_equal(cs->domain_span, cs->cpus_allowed))
+ build_sched_domains(cs->domain_span);
+ attach_domains(change_map);
+ unlock_cpu_hotplug();
+}
+
+static void update_sched_domain(struct cpuset *cs)
+{
+ struct cpuset *parent = cs->parent;
+ cpumask_t temp_map, change_map;
+ cpumask_t p_old_span = parent->domain_span, c_old_span = cs->domain_span;
+
+ if (is_removed(cs) || !is_cpu_exclusive(cs)) {
+ /* Exclusive bit off and no CPUs defined in cpuset (7) */
+ if (cpus_empty(cs->cpus_allowed))
+ return;
+ /* Exclusive bit off or delete an exclusive cpuset (5,6) */
+ cpus_or(parent->domain_span, parent->domain_span, cs->cpus_allowed);
+ change_map = parent->domain_span;
+ cs->domain_span = CPU_MASK_NONE;
+ }
+ else if (is_cpu_exclusive(cs)) {
+ if (cpus_subset(cs->cpus_allowed, cs->domain_span)) {
+ /* Remove some CPUs from an exclusive cpuset (4) */
+ cpus_andnot(temp_map, cs->domain_span, cs->cpus_allowed);
+ cpus_or(parent->domain_span, parent->domain_span, temp_map);
+ cpus_or(change_map, parent->domain_span, cs->domain_span);
+ }
+ else {
+ /* No CPUs defined in this cpuset as yet (2) */
+ if (cpus_empty(cs->cpus_allowed))
+ return;
+ /* Turn exclusive on or add CPUs to an exclusive cpuset (1,3) */
+ change_map = parent->domain_span;
+ cpus_andnot(temp_map, parent->cpus_allowed, cs->cpus_allowed);
+ cpus_and(parent->domain_span, parent->domain_span, temp_map);
+ }
+ cs->domain_span = cs->cpus_allowed;
+ }
+
+ if ((!cpus_equal(p_old_span, parent->domain_span))
+ && (!cpus_equal(c_old_span, cs->domain_span))
+ && (!cpus_equal(p_old_span, cs->domain_span)))
+ rebuild_domains(change_map, cs);
+}
+
static int update_cpumask(struct cpuset *cs, char *buf)
{
struct cpuset trialcs;
@@ -615,8 +671,11 @@ static int update_cpumask(struct cpuset
if (cpus_empty(trialcs.cpus_allowed))
return -ENOSPC;
retval = validate_change(cs, &trialcs);
- if (retval == 0)
+ if (retval == 0) {
cs->cpus_allowed = trialcs.cpus_allowed;
+ if (is_cpu_exclusive(cs))
+ update_sched_domain(cs);
+ }
return retval;
}
@@ -779,6 +838,8 @@ static ssize_t cpuset_common_file_write(
break;
case FILE_CPU_EXCLUSIVE:
retval = update_flag(CS_CPU_EXCLUSIVE, cs, buffer);
+ if (!retval)
+ update_sched_domain(cs);
break;
case FILE_MEM_EXCLUSIVE:
retval = update_flag(CS_MEM_EXCLUSIVE, cs, buffer);
@@ -1258,6 +1319,7 @@ static long cpuset_create(struct cpuset
if (notify_on_release(parent))
set_bit(CS_NOTIFY_ON_RELEASE, &cs->flags);
cs->cpus_allowed = CPU_MASK_NONE;
+ cs->domain_span = CPU_MASK_NONE;
cs->mems_allowed = NODE_MASK_NONE;
atomic_set(&cs->count, 0);
INIT_LIST_HEAD(&cs->sibling);
@@ -1319,6 +1381,8 @@ static int cpuset_rmdir(struct inode *un
spin_lock(&cs->dentry->d_lock);
parent = cs->parent;
set_bit(CS_REMOVED, &cs->flags);
+ if (is_cpu_exclusive(cs))
+ update_sched_domain(cs);
list_del(&cs->sibling); /* delete my sibling from parent->children */
if (list_empty(&parent->children))
check_for_release(parent);
@@ -1343,6 +1407,7 @@ int __init cpuset_init(void)
int err;
top_cpuset.cpus_allowed = CPU_MASK_ALL;
+ top_cpuset.domain_span = CPU_MASK_ALL;
top_cpuset.mems_allowed = NODE_MASK_ALL;
atomic_inc(&cpuset_mems_generation);
@@ -1378,7 +1443,9 @@ out:
void __init cpuset_init_smp(void)
{
- top_cpuset.cpus_allowed = cpu_online_map;
+ cpus_complement(top_cpuset.cpus_allowed, cpu_isolated_map);
+ cpus_and(top_cpuset.cpus_allowed, top_cpuset.cpus_allowed, cpu_online_map);
+ top_cpuset.domain_span = top_cpuset.cpus_allowed;
top_cpuset.mems_allowed = node_online_map;
}
next prev parent reply other threads:[~2005-04-23 7:09 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-07 0:51 [RFC PATCH] scheduler: Dynamic sched_domains Matthew Dobson
2004-10-07 2:13 ` Nick Piggin
2004-10-07 17:01 ` Jesse Barnes
2004-10-08 5:55 ` [Lse-tech] " Takayoshi Kochi
2004-10-08 6:08 ` Nick Piggin
2004-10-08 16:43 ` Jesse Barnes
2004-10-07 21:58 ` Matthew Dobson
2004-10-08 0:22 ` Nick Piggin
2004-10-07 22:20 ` Matthew Dobson
2004-10-07 4:12 ` [ckrm-tech] " Marc E. Fiuczynski
2004-10-07 5:35 ` Paul Jackson
2004-10-07 22:06 ` Matthew Dobson
2004-10-07 9:32 ` Paul Jackson
2004-10-08 10:14 ` [Lse-tech] " Erich Focht
2004-10-08 10:40 ` Nick Piggin
2004-10-08 15:50 ` [ckrm-tech] " Hubertus Franke
2004-10-08 22:48 ` Matthew Dobson
2004-10-08 18:54 ` Matthew Dobson
2004-10-08 21:56 ` Peter Williams
2004-10-08 22:52 ` Matthew Dobson
2004-10-08 23:13 ` Erich Focht
2004-10-08 23:50 ` Nick Piggin
2004-10-10 12:25 ` Erich Focht
2004-10-08 22:51 ` Erich Focht
2004-10-09 1:05 ` Matthew Dobson
2004-10-10 12:45 ` Erich Focht
2004-10-12 22:45 ` Matthew Dobson
2004-10-08 18:45 ` Matthew Dobson
2005-04-18 20:26 ` [RFC PATCH] Dynamic sched domains aka Isolated cpusets Dinakar Guniguntala
2005-04-18 23:44 ` Nick Piggin
2005-04-19 8:00 ` Dinakar Guniguntala
2005-04-19 5:54 ` Paul Jackson
2005-04-19 6:19 ` Nick Piggin
2005-04-19 6:59 ` Paul Jackson
2005-04-19 7:09 ` Nick Piggin
2005-04-19 7:25 ` Paul Jackson
2005-04-19 7:28 ` Paul Jackson
2005-04-19 7:19 ` Paul Jackson
2005-04-19 7:57 ` Nick Piggin
2005-04-19 20:34 ` Paul Jackson
2005-04-23 23:26 ` Paul Jackson
2005-04-26 0:52 ` Matthew Dobson
2005-04-26 0:59 ` Paul Jackson
2005-04-19 9:52 ` Dinakar Guniguntala
2005-04-19 15:26 ` Paul Jackson
2005-04-20 7:37 ` Dinakar Guniguntala
2005-04-19 20:42 ` Paul Jackson
2005-04-19 8:12 ` Simon Derr
2005-04-19 16:19 ` Paul Jackson
2005-04-19 9:34 ` [Lse-tech] " Dinakar Guniguntala
2005-04-19 17:23 ` Paul Jackson
2005-04-20 7:16 ` Dinakar Guniguntala
2005-04-20 19:09 ` Paul Jackson
2005-04-21 16:27 ` Dinakar Guniguntala
2005-04-22 21:26 ` Paul Jackson
2005-04-23 7:24 ` Dinakar Guniguntala [this message]
2005-04-23 22:30 ` Paul Jackson
2005-04-25 11:53 ` Dinakar Guniguntala
2005-04-25 14:38 ` Paul Jackson
2005-04-21 17:31 ` [RFC PATCH] Dynamic sched domains aka Isolated cpusets (v0.2) Dinakar Guniguntala
2005-04-22 18:50 ` Paul Jackson
2005-04-22 21:37 ` Paul Jackson
2005-04-23 3:11 ` Paul Jackson
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=20050423072424.GA3929@in.ibm.com \
--to=dino@in.ibm.com \
--cc=Simon.Derr@bull.net \
--cc=akpm@osdl.org \
--cc=colpatch@us.ibm.com \
--cc=dipankar@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lse-tech@lists.sourceforge.net \
--cc=nickpiggin@yahoo.com.au \
--cc=pj@sgi.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