[lkml]   [2012]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC 4/4] {RFC} kmod.c: Add new call_usermodehelper_timeout() API
On 03/22, Boaz Harrosh wrote:
> On 03/22/2012 07:27 AM, Oleg Nesterov wrote:
> >>
> >> usermodehelper: implement UMH_KILLABLE
> >>
> >> Implement UMH_KILLABLE, should be used along with UMH_WAIT_EXEC/PROC. The
> >> caller must ensure that subprocess_info->path/etc can not go away until
> >> call_usermodehelper_freeinfo().
> >> ...
> >>
> >> I think that my patch above does a much better/cleaner lifetime management of the
> >> subprocess_info struct, with the use of a kref.
> >
> > This is subjective, you know ;) I specially tried to avoid the
> > refcounting.
> >
> Why?
> The all kref_ abstraction comes to a simple atomic_inc/dec.

Again, this is subjective, but kref_ looks like the unnecessary
complication to me. But I won't insist, see below.

> > In any case. I do not know why do we need timeout, but this is
> > orthogonal to KILLABLE. Please redo your patches on top of -mm
> > tree? Please note that in this case the change becomes trivial.
> >
> Yes you are right.

OK, good.

> > Hmm. For example, exit_mm() does xchg().
> >
> Again, Personally I like xchg, but not here, not for an object
> life-time management. Two threads share a structure, that needs
> to go when the last one ends.

And xchg(info->complete) implements the simplest counter,
xchg() == NULL is equivalent to atomic_dec_and_test() == T.

But again, again, I won't argue if you send the patch which uses
kref_ instead. I do not maintain this code and I do not really mind.
And I never pretended my taste is good ;)

My point is, this is completely orthogonal to "add the timeout",
and if you want to change the refcounting I'd suggest a separate

What we need is wait_for_completion_state_timeout() to avoid
the horror like

if (UMH_KILLABLE && !timeout)
else if (UMH_KILLABLE && timeout)
else if (!UMH_KILLABLE && !timeout)

IOW, I think we need to export wait_for_common() first.

This is the only complication afaics. After that "add the timeout"
becomes almost one-liner, with or without "switch to kref_".

> Is there an mm git tree?

No, afaik

> random linux-next/master point. Which should do the job.

Yes, I think this should work.


 \ /
  Last update: 2012-03-23 14:45    [W:0.159 / U:2.572 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site