Re: [PATCH 3/8] vfork: make it killable

From: Matt Fleming
Date: Fri Jul 29 2011 - 09:02:17 EST


On Wed, 2011-07-27 at 18:32 +0200, Oleg Nesterov wrote:

[...]

> static long clone_vfork_finish(struct task_struct *child,
> struct completion *vfork_done, long pid)
> {
> - freezer_do_not_count();
> - wait_for_completion(vfork_done);
> - freezer_count();
> + int killed = wait_for_completion_killable(vfork_done);
> +
> + if (killed) {
> + struct completion *steal = xchg(&child->vfork_done, NULL);
> + /* if we race with complete_vfork_done() we have to wait */
> + if (unlikely(!steal))
> + wait_for_completion(vfork_done);
> +
> + return -EINTR;
> + }

Hmm.. isn't this inherently racy anyway? Why go to the trouble of trying
to handle this race at all?

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