Re: cpuset attach_task to touch per-cpu kernel threads?
From: Srivatsa Vaddagiri
Date: Thu Jun 21 2007 - 13:24:21 EST
On Thu, Jun 21, 2007 at 10:07:12AM -0700, Paul Jackson wrote:
> Ingo, responding to Srivatsa:
> > > Or maybe allow movement if it
> > > doesn't result in changing kernel-threads's cpu affinity.
> >
> > yeah, i'd agree ..
>
> Good point. I'd agree too.
Yeah .."allow movement if it doesn't result in changing kernel-threads's cpu
affinity" sounds good, except it is hard to implement in cpuset's
context I think. For ex: we now have to take additional steps when
changing 'cpus_allowed' of a cpuset such that it doesn't violate any cpu
affinity of kernel threads bound to the cpuset. That itself makes the
implementation complex I think.
How about a simpler patch which bans movement of kernel threads from its
home cpuset (i.e top cpuset)?
Index: current/kernel/cpuset.c
===================================================================
--- current.orig/kernel/cpuset.c 2007-06-21 19:42:18.000000000 +0530
+++ current/kernel/cpuset.c 2007-06-21 22:24:38.000000000 +0530
@@ -881,6 +881,10 @@
if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
return -ENOSPC;
+ /* Don't allow kernel threads to be moved */
+ if (!tsk->mm)
+ return -EINVAL;
+
return security_task_setscheduler(tsk, 0, NULL);
}
This probably catches exiting user-space tasks also (whose ->mm pointer is
null). Hmm ..there should be a better check for kernel threads.
--
Regards,
vatsa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/