lkml.org 
[lkml]   [2013]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kthread: Make kthread_create() killable.
On 09/15, Tetsuo Handa wrote:
>
> Oleg Nesterov wrote:
> > I am wondering if this can be simplified...
> >
> > At least you can move create->done from kthread_create_info to the
> > stack, and turn create->owner into the pointer to that completion.
>
> Use of DECLARE_COMPLETION_ONSTACK() looks harmful to me because current thread
> needs to be able to terminate as soon as possible if SIGKILLed

Sure.

> If we move something from kmalloc()ed zone to stack,
> current thread cannot be terminated until that something is guaranteed to no
> longer be used.

Please look at call_usermodehelper_exec() which does this trick. The
logic is the same, just you need to xchg(create->completion) instead
of create->owner.

In any case "void *owner" looks strange. It is in fact boolean (in
your patch). You can even use, say, test_and_set_bit() instead of
xchg.

Oleg.



\
 
 \ /
  Last update: 2013-09-15 19:01    [W:0.718 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site