Linux 4.18 Set To Receive Scheduler Optimization For vCPUs

Rohit Jain of Oracle sent in a patch this week that is already queued as part of scheduler work for the next kernel series, Linux 4.18. The patch is sched/core: Don't schedule threads on pre-empted vCPUs. Rohit explained:
In paravirt configurations today, spinlocks figure out whether a vCPU is running to determine whether or not spinlock should bother spinning. We can use the same logic to prioritize CPUs when scheduling threads. If a vCPU has been pre-empted, it will incur the extra cost of VMENTER and the time it actually spends to be running on the host CPU. If we had other vCPUs which were actually running on the host CPU and idle we should schedule threads there.
The Oracle developer found improvements with the "schbench" scheduler benchmark improved generally by a few percent but in some cases were up to a 8~25% improvement with this three line patch to return when the vCPU is pre-empted.
3 Comments