[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJhGHyDJ8XG6ZCC-NoATFgyeuyEq_A7zmF4TSFA5ubONv7Mx1g@mail.gmail.com>
Date: Wed, 15 Dec 2021 00:14:17 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: Vipin Sharma <vipinsh@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
David Matlack <dmatlack@...gle.com>, kvm@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] KVM: Move VM's worker kthreads back to the original
cgroups before exiting.
On Tue, Dec 14, 2021 at 4:13 PM Vipin Sharma <vipinsh@...gle.com> 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@...gle.com>
> ---
> 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
Powered by blists - more mailing lists