Re: [PATCH 1/2] kthread_create

Davide Libenzi
2004-01-07T07:25:37Z

On Wed, 7 Jan 2004, Rusty Russell wrote:

> In message <Pine.LNX.4.44.0401042243510.16042-100000@bigblue.dev.mdolabs.com> you write:
> > On Mon, 5 Jan 2004, Rusty Russell wrote:
> > > Nope. That's EXACTLY the kind of burden on the caller I wanted to
> > > avoid if at all possible.
> >
> > Which burden? The kthread is a resource and a "struct kthread" is an
> > handle to the resource. You create the resource (kthread_create()), you
> > control the resource (kthread_start()) and you free the resource
> > (kthread_stop()). To me it's simple and clean and does not require hacks
> > like taking owerships of tasks and using SIGCLD/waitpid to communicate.
> > Anyway, that's your baby and you'll take your choice.
>
> Thinking more about this issue lead me to rewrite the code to be
> simpler to use. Main benefit is that the transition from existing
> code is minimal.
>
> Latest version of patch, and code which uses it. It's actually quite
> neat now. Changes since first version:
>
> 1) kthread_start() deleted in favor of wake_up_process() directly.
> 2) New kthread_bind() for just-created threads, to replace original
> migration thread open-coded version.
> 3) Slight simplification: thread named only if spawned OK.

Yes, I like this better. Without any doubt, the removal of sync'd start
function simplified things a lot.

- Davide