Prev: [PATCH repost] sched: export sched_set/getaffinity to modules
Next: [PATCH 15/16] staging/wlags49_h2: use ARRAY_SIZE
From: Oleg Nesterov on 1 Jul 2010 11:00 On 07/01, Tejun Heo wrote: > > All that's necessary is shortcutting indirection through kthreadd. > ie. An exported function which looks like the following, > > struct kthread_clone_or_whatever(int (*threadfn).....) > { > struct kthread_create_info create; > int pid; > > INIT create; > > pid = kernel_thread(kthread, &create, CLONE_FS...); > if (pid < 0) > return ERROR; > wait_for_completion(&create.done); > > if (!IS_ERR(create.result)) > SET NAME; > return create.result; > } > > It might be a good idea to make the function take extra clone flags > but anyways once created cloned task can be treated the same way as > other kthreads, so nothing else needs to be changed. This makes kthread_stop() work. Otherwise the new thread is just the CLONE_VM child of the caller, and the caller is the user-mode task doing ioctl() ? Oleg. -- 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: Tejun Heo on 1 Jul 2010 11:00 Hello, On 07/01/2010 04:46 PM, Oleg Nesterov wrote: >> It might be a good idea to make the function take extra clone flags >> but anyways once created cloned task can be treated the same way as >> other kthreads, so nothing else needs to be changed. > > This makes kthread_stop() work. Otherwise the new thread is just > the CLONE_VM child of the caller, and the caller is the user-mode > task doing ioctl() ? Hmmm, indeed. It makes the attribute inheritance work but circumvents the whole reason there is kthreadd. Thanks. -- tejun -- 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 11:00 On Thu, 2010-07-01 at 16:53 +0200, Tejun Heo wrote: > Hello, > > On 07/01/2010 04:46 PM, Oleg Nesterov wrote: > >> It might be a good idea to make the function take extra clone flags > >> but anyways once created cloned task can be treated the same way as > >> other kthreads, so nothing else needs to be changed. > > > > This makes kthread_stop() work. Otherwise the new thread is just > > the CLONE_VM child of the caller, and the caller is the user-mode > > task doing ioctl() ? > > Hmmm, indeed. It makes the attribute inheritance work but circumvents > the whole reason there is kthreadd. I thought the whole reason there was threadd was to avoid the inheritance? So avoiding the avoiding of inheritance seems like the goal here, no? -- 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: Sridhar Samudrala on 2 Jul 2010 14:10 On 7/1/2010 7:55 AM, Peter Zijlstra wrote: > On Thu, 2010-07-01 at 16:53 +0200, Tejun Heo wrote: > >> Hello, >> >> On 07/01/2010 04:46 PM, Oleg Nesterov wrote: >> >>>> It might be a good idea to make the function take extra clone flags >>>> but anyways once created cloned task can be treated the same way as >>>> other kthreads, so nothing else needs to be changed. >>>> >>> This makes kthread_stop() work. Otherwise the new thread is just >>> the CLONE_VM child of the caller, and the caller is the user-mode >>> task doing ioctl() ? >>> >> Hmmm, indeed. It makes the attribute inheritance work but circumvents >> the whole reason there is kthreadd. >> > I thought the whole reason there was threadd was to avoid the > inheritance? So avoiding the avoiding of inheritance seems like the goal > here, no? > I think so. Does it (Tejun's kthread_clone() patch) also inherit the cgroup of the caller? or do we still need the explicit call to attach the thread to the current task's cgroup? I am on vacation next week and cannot look into this until Jul 12. Hope this will be resoved by then. If not, i will look into after i am back. Thanks Sridhar -- 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 2 Jul 2010 14:20
On Fri, 2010-07-02 at 11:01 -0700, Sridhar Samudrala wrote: > > Does it (Tejun's kthread_clone() patch) also inherit the > cgroup of the caller? Of course, its a simple do_fork() which inherits everything just as you would expect from a similar sys_clone()/sys_fork() call. -- 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/ |