Re: [PATCH 1/2] kthread_create

Davide Libenzi
2003-12-31T05:56:08Z

On Wed, 31 Dec 2003, Rusty Russell wrote:

> In message <Pine.LNX.4.44.0312302100550.1457-100000@bigblue.dev.mdolabs.com> you write:
> > Wouldn't it be better to put a kt_message inside a tast_struct?
>
> Expand task_struct for this one usage? I don't think that's
> worthwhile.
>
> The whole code is written so there is no datastructure associated with
> the kthread. When something like kt_message is needed (to kill a
> thread, for example), they grab the lock and use the static one.
>
> This means that threads can exit without having to do cleanup.

I agree on one side, there's the drawback on a size increase (3 pointers,
plus eventually a spinlock) of the task struct. But IMO the code would be
cleaner, since you know who is the target of the message. Also it would
not require any cleanup since there would be nothing allocated, just a
struct member inside task_struct.
Also, what happens in the task woke up by a send does not reschedule
before another CPU does another send? Wouldn't a message be lost?

- Davide