Re: [PATCH] kthread: Enhance kthread_stop to abort interruptible sleeps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/24, Oleg Nesterov wrote:
>
> Hm, mm_release() clears ->vfork_done before complete().
> 
> 	mm_release:
> 
> 		struct completion *vfork_done = tsk->vfork_done;
> 
> 		if (vfork_done) {
> 			tsk->vfork_done = NULL;
> 			complete(vfork_done);
> 		}
> 
> 
> 	kthread_stop:
> 
> 		set_tsk_thread_flag(tsk, TIF_KTHREAD_STOP);
> 		signal_wake_up(tsk, 1);
> 
> 		// tsk exits, sets ->vfork_done == NULL
> 
> 		wait_for_completion(tsk->vfork_done);

Since the task_struct should be pinned anyway, I think kthread_stop()
should do:

	vfork_done = tsk->vfork_done;
	barrier();
	if (vfork_done)
		wait_for_completion(vfork_done);

Oleg.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux