Re: [PATCH] Add module_kernel_thread for threads that live in modules.

Martin Diehl (lists@mdiehl.de)
Mon, 16 Jun 2003 10:57:36 +0200 (CEST)


On Mon, 16 Jun 2003, Rusty Russell wrote:

> In message <Pine.LNX.4.44.0306160907470.2079-100000@notebook.home.mdiehl.de> you write:
> > Why using keventd? Personally I'd prefer a synchronous thread start/stop,
> > particularly with the thread living in a module.
> > Maybe some generalisation of:
>
> It would be syncronous:

You mean your cleanup_thread would block for completion of the keventd
stuff? Ok, this would work. But then, when calling cleanup_thread, f.e. we
must not hold any semaphore which might be acquired by _any_ other work
scheduled for keventd or we might end in deadlock (like the rtnl+hotplug
issue we had seen recently).

> but doing kernel_thread yourself means trying
> to clean up using daemonize et al, which is incomplete and always
> makes me nervous.

I thought this was fixed in 2.5 for some time now, but seems I shouldn't
rely on that ;-)

> An implementation detail to users, but IMHO an important one.
>
> Also, this replaces complete_and_exit: the thread can just exit. This
> simplifies things for the users, too...

Personally I do like the complete_and_exit thing as a simple and clear
finalisation point. And if I didn't miss something above wrt. your
cleanup_kthread being synchronous I'm not sure whether the locking
implication do really make things easier - YMMV of course.

Thanks.
Martin

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/