Re: [PATCH 00/10] sched/kvm: Semantics-aware vCPU scheduling for oversubscribed KVM
From: K Prateek Nayak
Date: Wed Nov 12 2025 - 01:07:08 EST
Hello Wanpeng,
On 11/12/2025 10:24 AM, Wanpeng Li wrote:
>>> Problem Statement
>>> -----------------
>>>
>>> In overcommitted virtualization scenarios, vCPUs frequently spin on locks
>>> held by other vCPUs that are not currently running. The kernel's
>>> paravirtual spinlock support detects these situations and calls yield_to()
>>> to boost the lock holder, allowing it to run and release the lock.
>>>
>>> However, the current implementation has two critical limitations:
>>>
>>> 1. Scheduler-side limitation:
>>>
>>> yield_to_task_fair() relies solely on set_next_buddy() to provide
>>> preference to the target vCPU. This buddy mechanism only offers
>>> immediate, transient preference. Once the buddy hint expires (typically
>>> after one scheduling decision), the yielding vCPU may preempt the target
>>> again, especially in nested cgroup hierarchies where vruntime domains
>>> differ.
>>
>> So what you are saying is there are configurations out there where vCPUs
>> of same guest are put in different cgroups? Why? Does the use case
>> warrant enabling the cpu controller for the subtree? Are you running
>
> You're right to question this. The problematic scenario occurs with
> nested cgroup hierarchies, which is common when VMs are deployed with
> cgroup-based resource management. Even when all vCPUs of a single
> guest are in the same leaf cgroup, that leaf sits under parent cgroups
> with their own vruntime domains.
>
> The issue manifests when:
> - set_next_buddy() provides preference at the leaf level
> - But vruntime competition happens at parent levels
If that is the case, then NEXT_BUDDY is in-eligible as a result of its
vruntime being higher that the weighted averages of other entity.
Won't this break fairness?
Let me go look at the series and come back.
> - The buddy hint gets "diluted" when pick_task_fair() walks up the hierarchy
>
--
Thanks and Regards,
Prateek