From: Paul Jackson <pj@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Simon Derr <Simon.Derr@bull.net>, Paul Jackson <pj@sgi.com>,
linux-kernel@vger.kernel.org
Subject: [Patch 2/4] cpusets simplify cpus_allowed setting in attach
Date: Sat, 11 Sep 2004 01:28:20 -0700 (PDT) [thread overview]
Message-ID: <20040911082822.10372.73487.44927@sam.engr.sgi.com> (raw)
In-Reply-To: <20040911082810.10372.86008.84920@sam.engr.sgi.com>
When reattaching a task to a different cpuset, I had
code that attempted to preserve the cpuset relative
placement of the task (such as might have been done
using sched_setaffinity, mbind or set_mempolicy) by
rebinding the task to the intersection of its old
and new placement, if not empty.
This resulted in strange and puzzling behaviour, such
as having a tasks cpus_allowed not change if the task
was reattached to the root cpuset.
Simplify the code - when attaching a task to a cpuset,
simply set its cpus_allowed to that of the cpuset.
This is much less surprising in practice.
Signed-off-by: Paul Jackson <pj@sgi.com>
Index: 2.6.9-rc1-mm4/kernel/cpuset.c
===================================================================
--- 2.6.9-rc1-mm4.orig/kernel/cpuset.c 2004-09-08 15:22:59.000000000 -0700
+++ 2.6.9-rc1-mm4/kernel/cpuset.c 2004-09-08 18:44:33.000000000 -0700
@@ -605,7 +605,6 @@ static int attach_task(struct cpuset *cs
pid_t pid;
struct task_struct *tsk;
struct cpuset *oldcs;
- cpumask_t cpus;
if (sscanf(buf, "%d", &pid) != 1)
return -EIO;
@@ -645,16 +644,7 @@ static int attach_task(struct cpuset *cs
tsk->cpuset = cs;
task_unlock(tsk);
- /*
- * If the tasks current CPU placement overlaps with its new cpuset,
- * then let it run in that overlap. Otherwise fallback to simply
- * letting it have the run of the CPUs in the new cpuset.
- */
- if (cpus_intersects(tsk->cpus_allowed, cs->cpus_allowed))
- cpus_and(cpus, tsk->cpus_allowed, cs->cpus_allowed);
- else
- cpus = cs->cpus_allowed;
- set_cpus_allowed(tsk, cpus);
+ set_cpus_allowed(tsk, cs->cpus_allowed);
put_task_struct(tsk);
if (atomic_dec_and_test(&oldcs->count))
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
next prev parent reply other threads:[~2004-09-11 8:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-11 8:28 [Patch 0/4] four small cpuset patches Paul Jackson
2004-09-11 8:28 ` [Patch 1/4] cpusets display allowed masks in proc status Paul Jackson
2004-09-11 8:28 ` Paul Jackson [this message]
2004-09-11 8:28 ` [Patch 3/4] cpusets remove useless validation check Paul Jackson
2004-09-11 8:28 ` [Patch 4/4] cpusets top mask just online, not all possible Paul Jackson
2004-09-11 14:10 ` Anton Blanchard
2004-09-11 17:07 ` Paul Jackson
2004-09-11 17:28 ` Dave Hansen
2004-09-12 2:21 ` Paul Jackson
2004-09-12 4:43 ` Dave Hansen
2004-09-12 5:35 ` Paul Jackson
2004-09-12 5:42 ` Paul Jackson
2004-09-11 17:39 ` Dave Hansen
2004-09-11 18:55 ` Andi Kleen
2004-09-12 2:29 ` 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=20040911082822.10372.73487.44927@sam.engr.sgi.com \
--to=pj@sgi.com \
--cc=Simon.Derr@bull.net \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®