#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[derive(Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub enum GlobalNumaBalancingConfiguration
{
Off,
On(GlobalNumaBalancingOnConfiguration),
}
impl Default for GlobalNumaBalancingConfiguration
{
#[inline(always)]
fn default() -> Self
{
GlobalNumaBalancingConfiguration::Off
}
}
impl GlobalNumaBalancingConfiguration
{
pub fn configure(&self, proc_path: &ProcPath) -> Result<(), GlobalNumaBalancingConfigurationError>
{
use self::GlobalNumaBalancingConfiguration::*;
match self
{
Off => Self::configure_enablement(proc_path, false)?,
On(ref numa_balancing_on_configuration) =>
{
Self::configure_enablement(proc_path, true)?;
numa_balancing_on_configuration.configure(proc_path)?;
},
}
Ok(())
}
#[inline(always)]
fn configure_enablement(proc_path: &ProcPath, value: bool) -> Result<(), GlobalNumaBalancingConfigurationError>
{
set_proc_sys_kernel_value(proc_path, "numa_balancing", Some(value), GlobalNumaBalancingConfigurationError::CouldNotChangeEnablement)
}
}