Re: [PATCH] KVM: Move VM's worker kthreads back to the original cgroups before exiting.

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

 



On Tue, Dec 14, 2021 at 4:13 PM Vipin Sharma <vipinsh@xxxxxxxxxx> wrote:
>
> VM worker kthreads can linger in the VM process's cgroup for sometime
> after KVM temrinates the VM process.
>
> KVM terminates the worker kthreads by calling kthread_stop() which waits
> on the signal generated by exit_mm() in do_exit() during kthread's exit.
> However, these kthreads are removed from the cgroup using cgroup_exit()
> call which happens after exit_mm() in do_exit(). A VM process can
> terminate between the time window of exit_mm() to cgroup_exit(), leaving
> only worker kthreads in the cgroup.
>
> Moving worker kthreads back to the original cgroup (kthreadd_task's
> cgroup) makes sure that cgroup is empty as soon as the main VM process
> is terminated.
>
> Signed-off-by: Vipin Sharma <vipinsh@xxxxxxxxxx>
> ---
>  virt/kvm/kvm_main.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

Hello

Off-topic, can this kvm worker_thread and the thread to do async pagefault
be possibly changed to use something like io_uring's IOWQ (fs/io-wq.c)
created by create_io_thread()?

So that every resource the threads used are credited to the process
of the vm.

Thanks
Lai



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux