Re: proper way to terminate a kthread when the parent process dies ?

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Tue, 4 Aug 2015 19:46:03 +0300
On Tue, Aug 04, 2015 at 06:27:46PM +0200, Luigi Rizzo wrote:
> Specifically, our two threads implement the host part of a virtualized network
> interface and operate in a way that is very similar to an interrupt handler,
> or vhost-net in KVM. In principle, the user process that issues
> the system call could be unaware of the existence and number of
> those threads; that is why we went for a "kernel thread" created
> within the kernel.

You might try to construct this using the recently added
initialize_thread argument to the thread_create(). Specifically,
you could call cpu_set_fork_handler() there, instead of
cpu_set_upcall(_kse)(), to leave the thread in the kernel and force it
to execute your function.
Received on Tue Aug 04 2015 - 14:46:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:59 UTC