Prev: [PATCH repost] sched: export sched_set/getaffinity to modules
Next: [PATCH 15/16] staging/wlags49_h2: use ARRAY_SIZE
From: Peter Zijlstra on 1 Jul 2010 07:30 On Thu, 2010-07-01 at 14:07 +0300, Michael S. Tsirkin wrote: > Author: Sridhar Samudrala <sri(a)us.ibm.com> > > sched: export sched_set/getaffinity to modules > > vhost-net driver wants to copy the affinity from the > owner thread to thread it creates. Export > sched_set/get affinity to modules to make this possible > when vhost is built as a module. > > Signed-off-by: Sridhar Samudrala <sri(a)us.ibm.com> > Signed-off-by: Michael S. Tsirkin <mst(a)redhat.com> > > --- > > I'm not sure the previous time made it clear what exactly is the > proposed change, so reposting. Info, Peter, could you ack merging the > following through the net-next tree please? > > diff --git a/kernel/sched.c b/kernel/sched.c > index d484081..3759391 100644 > --- a/kernel/sched.c > +++ b/kernel/sched.c > @@ -4744,6 +4744,7 @@ out_put_task: > put_online_cpus(); > return retval; > } > +EXPORT_SYMBOL_GPL(sched_setaffinity); > > static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len, > struct cpumask *new_mask) > @@ -4807,6 +4808,7 @@ out_unlock: > > return retval; > } > +EXPORT_SYMBOL_GPL(sched_getaffinity); > > /** > * sys_sched_getaffinity - get the cpu affinity of a process Urgh,.. so why again is that a good idea? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on 1 Jul 2010 07:50 On Thu, 2010-07-01 at 13:19 +0200, Peter Zijlstra wrote: > On Thu, 2010-07-01 at 14:07 +0300, Michael S. Tsirkin wrote: > > Author: Sridhar Samudrala <sri(a)us.ibm.com> > > > > sched: export sched_set/getaffinity to modules > > > > vhost-net driver wants to copy the affinity from the > > owner thread to thread it creates. Export > > sched_set/get affinity to modules to make this possible > > when vhost is built as a module. > Urgh,.. so why again is that a good idea? In particular: - who sets the affinity of the task? - why can't it set the kernel thread's affinity too? - what happens if someone changes the tasks' affinity? So no, I don't think this is a sensible thing to do at all. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Michael S. Tsirkin on 1 Jul 2010 08:10 On Thu, Jul 01, 2010 at 01:43:23PM +0200, Peter Zijlstra wrote: > On Thu, 2010-07-01 at 13:19 +0200, Peter Zijlstra wrote: > > On Thu, 2010-07-01 at 14:07 +0300, Michael S. Tsirkin wrote: > > > Author: Sridhar Samudrala <sri(a)us.ibm.com> > > > > > > sched: export sched_set/getaffinity to modules > > > > > > vhost-net driver wants to copy the affinity from the > > > owner thread to thread it creates. Export > > > sched_set/get affinity to modules to make this possible > > > when vhost is built as a module. > > > Urgh,.. so why again is that a good idea? > > In particular: > - who sets the affinity of the task? management tools do this when they start qemu. > - why can't it set the kernel thread's affinity too? It can. However: the threads are started internally by the driver when qemu does an ioctl. What we want to do is give it a sensible default affinity. management tool can later tweak it if it wants to. > - what happens if someone changes the tasks' affinity? We would normally create a cgroup including all internal tasks, making it easy to find and change affinity for them all if necessary. > So no, I don't think this is a sensible thing to do at all. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on 1 Jul 2010 08:40 On Thu, 2010-07-01 at 15:23 +0300, Michael S. Tsirkin wrote: > > The patch using this is here: > http://www.mail-archive.com/kvm(a)vger.kernel.org/msg35411.html > > It simply copies the affinity from the parent when thread is created. Sounds like policy, not something the kernel should do.. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Michael S. Tsirkin on 1 Jul 2010 08:40
On Thu, Jul 01, 2010 at 02:55:07PM +0300, Michael S. Tsirkin wrote: > On Thu, Jul 01, 2010 at 01:43:23PM +0200, Peter Zijlstra wrote: > > On Thu, 2010-07-01 at 13:19 +0200, Peter Zijlstra wrote: > > > On Thu, 2010-07-01 at 14:07 +0300, Michael S. Tsirkin wrote: > > > > Author: Sridhar Samudrala <sri(a)us.ibm.com> > > > > > > > > sched: export sched_set/getaffinity to modules > > > > > > > > vhost-net driver wants to copy the affinity from the > > > > owner thread to thread it creates. Export > > > > sched_set/get affinity to modules to make this possible > > > > when vhost is built as a module. > > > > > Urgh,.. so why again is that a good idea? > > > > In particular: > > - who sets the affinity of the task? > > management tools do this when they start qemu. > > > - why can't it set the kernel thread's affinity too? > > It can. However: the threads are started internally by the driver > when qemu does an ioctl. What we want to do is give it a sensible > default affinity. management tool can later tweak it if it wants to. > > > - what happens if someone changes the tasks' affinity? > > We would normally create a cgroup including all internal > tasks, making it easy to find and change affinity for > them all if necessary. > > > So no, I don't think this is a sensible thing to do at all. The patch using this is here: http://www.mail-archive.com/kvm(a)vger.kernel.org/msg35411.html It simply copies the affinity from the parent when thread is created. -- MST -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |