All of lore.kernel.org
 help / color / mirror / Atom feed
* cpuset: Check if the cpus allowed is a subset of the cpuset's cpus for PF_THREAD_BOUND threads
@ 2009-03-12 17:45 Dhaval Giani
  2009-03-13  0:06 ` [tip:sched/urgent] " Dhaval Giani
  0 siblings, 1 reply; 4+ messages in thread
From: Dhaval Giani @ 2009-03-12 17:45 UTC (permalink / raw)
  To: Srivatsa Vaddagiri, lkml, Andrew Morton, menage; +Cc: Balbir Singh


When a kernel thread which has been bound to a CPU is moved to
a cpuset which is a superset of the CPU it is bound to, the
movement fails.

[root@llm11 cgroups]# mkdir a
[root@llm11 cgroups]# echo 3 > a/cpuset.cpus
[root@llm11 cgroups]# echo 0 > a/cpuset.mems
[root@llm11 cgroups]# echo 12 > a/tasks
[root@llm11 cgroups]# echo 12 > tasks
-bash: echo: write error: Invalid argument
[root@llm11 cgroups]# cat cpuset.cpus
0-7
[root@llm11 cgroups]#

(pid 12 is the migration thread bound to CPU 3)

Change the check to see if the cpus allowed is a subset of the
cpus allowed for that cpuset.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
---
 kernel/cpuset.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1362,7 +1362,7 @@ static int cpuset_can_attach(struct cgro
 
 	if (tsk->flags & PF_THREAD_BOUND) {
 		mutex_lock(&callback_mutex);
-		if (!cpumask_equal(&tsk->cpus_allowed, cs->cpus_allowed))
+		if (!cpumask_subset(&tsk->cpus_allowed, cs->cpus_allowed))
 			ret = -EINVAL;
 		mutex_unlock(&callback_mutex);
 	}
-- 
regards,
Dhaval

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:sched/urgent] cpuset: Check if the cpus allowed is a subset of the cpuset's cpus for PF_THREAD_BOUND threads
  2009-03-12 17:45 cpuset: Check if the cpus allowed is a subset of the cpuset's cpus for PF_THREAD_BOUND threads Dhaval Giani
@ 2009-03-13  0:06 ` Dhaval Giani
  2009-03-13  1:32   ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Dhaval Giani @ 2009-03-13  0:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, vatsa, hpa, mingo, dhaval, balbir, akpm, tglx, mingo

Commit-ID:  5a98d36112f4301f068b638d6e0db2357f7deb75
Gitweb:     http://git.kernel.org/tip/5a98d36112f4301f068b638d6e0db2357f7deb75
Author:     Dhaval Giani <dhaval@linux.vnet.ibm.com>
AuthorDate: Thu, 12 Mar 2009 23:15:01 +0530
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 13 Mar 2009 00:21:25 +0100

cpuset: Check if the cpus allowed is a subset of the cpuset's cpus for PF_THREAD_BOUND threads

When a kernel thread which has been bound to a CPU is moved to
a cpuset which is a superset of the CPU it is bound to, the
movement fails.

 [root@llm11 cgroups]# mkdir a
 [root@llm11 cgroups]# echo 3 > a/cpuset.cpus
 [root@llm11 cgroups]# echo 0 > a/cpuset.mems
 [root@llm11 cgroups]# echo 12 > a/tasks
 [root@llm11 cgroups]# echo 12 > tasks
 -bash: echo: write error: Invalid argument
 [root@llm11 cgroups]# cat cpuset.cpus
 0-7
 [root@llm11 cgroups]#

(pid 12 is the migration thread bound to CPU 3)

Change the check to see if the cpus allowed is a subset of the
cpus allowed for that cpuset.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: menage@google.com
LKML-Reference: <20090312174501.GA7821@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/cpuset.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index f76db9d..34cfd46 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1362,7 +1362,7 @@ static int cpuset_can_attach(struct cgroup_subsys *ss,
 
 	if (tsk->flags & PF_THREAD_BOUND) {
 		mutex_lock(&callback_mutex);
-		if (!cpumask_equal(&tsk->cpus_allowed, cs->cpus_allowed))
+		if (!cpumask_subset(&tsk->cpus_allowed, cs->cpus_allowed))
 			ret = -EINVAL;
 		mutex_unlock(&callback_mutex);
 	}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [tip:sched/urgent] cpuset: Check if the cpus allowed is a subset of the cpuset's cpus for PF_THREAD_BOUND threads
  2009-03-13  0:06 ` [tip:sched/urgent] " Dhaval Giani
@ 2009-03-13  1:32   ` Ingo Molnar
  2009-03-13  1:43     ` Li Zefan
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-03-13  1:32 UTC (permalink / raw)
  To: mingo, hpa, vatsa, linux-kernel, dhaval, balbir, akpm, tglx
  Cc: linux-tip-commits


* Dhaval Giani <dhaval@linux.vnet.ibm.com> wrote:

> Commit-ID:  5a98d36112f4301f068b638d6e0db2357f7deb75
> Gitweb:     http://git.kernel.org/tip/5a98d36112f4301f068b638d6e0db2357f7deb75
> Author:     Dhaval Giani <dhaval@linux.vnet.ibm.com>
> AuthorDate: Thu, 12 Mar 2009 23:15:01 +0530
> Commit:     Ingo Molnar <mingo@elte.hu>
> CommitDate: Fri, 13 Mar 2009 00:21:25 +0100
> 
> cpuset: Check if the cpus allowed is a subset of the cpuset's 
> cpus for PF_THREAD_BOUND threads

Dropped this patch for now - Andrew says it got NAK-ed and he's 
handling it with other fixes.

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [tip:sched/urgent] cpuset: Check if the cpus allowed is a subset of the cpuset's cpus for PF_THREAD_BOUND threads
  2009-03-13  1:32   ` Ingo Molnar
@ 2009-03-13  1:43     ` Li Zefan
  0 siblings, 0 replies; 4+ messages in thread
From: Li Zefan @ 2009-03-13  1:43 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, vatsa, linux-kernel, dhaval, balbir, akpm, tglx,
	linux-tip-commits

CC: David Rientjes <rientjes@google.com>

Ingo Molnar wrote:
> * Dhaval Giani <dhaval@linux.vnet.ibm.com> wrote:
> 
>> Commit-ID:  5a98d36112f4301f068b638d6e0db2357f7deb75
>> Gitweb:     http://git.kernel.org/tip/5a98d36112f4301f068b638d6e0db2357f7deb75
>> Author:     Dhaval Giani <dhaval@linux.vnet.ibm.com>
>> AuthorDate: Thu, 12 Mar 2009 23:15:01 +0530
>> Commit:     Ingo Molnar <mingo@elte.hu>
>> CommitDate: Fri, 13 Mar 2009 00:21:25 +0100
>>
>> cpuset: Check if the cpus allowed is a subset of the cpuset's 
>> cpus for PF_THREAD_BOUND threads
> 
> Dropped this patch for now - Andrew says it got NAK-ed and he's 
> handling it with other fixes.
> 

It's not a bug, it's David Rientjes that introduced this behavior:
	9985b0bab332289f14837eff3c6e0bcc658b58f7

And here was the discussion:
	http://lkml.org/lkml/2008/6/5/310

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-13  1:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-12 17:45 cpuset: Check if the cpus allowed is a subset of the cpuset's cpus for PF_THREAD_BOUND threads Dhaval Giani
2009-03-13  0:06 ` [tip:sched/urgent] " Dhaval Giani
2009-03-13  1:32   ` Ingo Molnar
2009-03-13  1:43     ` Li Zefan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.