On Thu, Nov 07, 2024, Tejun Heo wrote: > Hello, > > On Thu, Nov 07, 2024 at 07:05:46PM +0100, Michal Koutný wrote: > ... > > I'd first ask why the kvm_vm_worker_thread needs to be in the KVM task's > > cgroup (and copy its priority at creation time but no later adjustments)? > > > > If it can remain inside root cgroup (like any other good kthread) its > > job may be even chunked into periodic/deferred workqueue pieces with no > > kthread per KVM at all. > > That'd be better but I suppose kvm wants them in the same cgroup for a > reason. Yes. The one and only user of kvm_vm_create_worker_thread() does non-trivial work on behalf of the VM, and so we want all of the CPU time consumed by that work to be charged to the VM's container, e.g. so that a VM that is generating a lot of work doesn't negatively impact other VMs on the same host (the amount of work done is directly affected by how the guest is accessing its memory).