Provide a config option to enable the steal_governor driver.
Since the feature targets paravirtualized environments and requires SMP,
enforce those dependencies. The driver selects CONFIG_PREFERRED_CPU
for the core scheduler mechanisms to work.

It is recommended to build the driver as a module (m) instead of
built-in (y) due to the following reasons:

- Module parameters are read-only after initialization. Building as a
  module allows updating these parameters by simply reloading the module.
  Default module parameters cannot work in all configurations.

- The driver can be completely disabled by unloading the module.

- This feature works best when all VMs operate in a cooperative manner.
  Requiring an explicit module load ensures intentional deployment
  across all VMs by the system administrator.

Suggested-by: Yury Norov <[email protected]>
Signed-off-by: Shrikanth Hegde <[email protected]>
---
 drivers/virt/Kconfig  | 18 ++++++++++++++++++
 drivers/virt/Makefile |  1 +
 2 files changed, 19 insertions(+)

diff --git a/drivers/virt/Kconfig b/drivers/virt/Kconfig
index 52eb7e4ba71f..6681d06363f9 100644
--- a/drivers/virt/Kconfig
+++ b/drivers/virt/Kconfig
@@ -41,6 +41,24 @@ config FSL_HV_MANAGER
           4) A kernel interface for receiving callbacks when a managed
             partition shuts down.
 
+config STEAL_GOVERNOR
+       tristate "Dynamic vCPU management based on steal time"
+       depends on PARAVIRT && SMP
+       select PREFERRED_CPU
+       default m
+       help
+         This driver helps to reduce the steal time in paravirtualized
+         environments, thereby reducing vCPU preemption. Reducing vCPU
+         preemption provides improved lock holder preemption and reduces
+         cost of vCPU preemption in the host.
+
+         By default preferred CPUs will be same as active CPUs. Depending
+         on the steal time when steal_governor driver is enabled,
+         preferred CPUs could become subset of active CPUs.
+
+         It is recommended to build it as module and load the module
+         to enable it.
+
 source "drivers/virt/vboxguest/Kconfig"
 
 source "drivers/virt/nitro_enclaves/Kconfig"
diff --git a/drivers/virt/Makefile b/drivers/virt/Makefile
index f29901bd7820..05fb075ef5b8 100644
--- a/drivers/virt/Makefile
+++ b/drivers/virt/Makefile
@@ -5,6 +5,7 @@
 
 obj-$(CONFIG_FSL_HV_MANAGER)   += fsl_hypervisor.o
 obj-$(CONFIG_VMGENID)          += vmgenid.o
+obj-$(CONFIG_STEAL_GOVERNOR)   += steal_governor.o
 obj-y                          += vboxguest/
 
 obj-$(CONFIG_NITRO_ENCLAVES)   += nitro_enclaves/
-- 
2.47.3


Reply via email to