mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-17 23:07:55 +00:00
Merge pull request #4114 from yangfeiyu20102011/main
agent: modify the type of swappiness to u64
This commit is contained in:
@@ -391,7 +391,7 @@ fn set_memory_resources(cg: &cgroups::Cgroup, memory: &LinuxMemory, update: bool
|
||||
|
||||
if let Some(swappiness) = memory.swappiness {
|
||||
if (0..=100).contains(&swappiness) {
|
||||
mem_controller.set_swappiness(swappiness as u64)?;
|
||||
mem_controller.set_swappiness(swappiness)?;
|
||||
} else {
|
||||
return Err(anyhow!(
|
||||
"invalid value:{}. valid memory swappiness range is 0-100",
|
||||
|
@@ -265,7 +265,7 @@ pub fn resources_grpc_to_oci(res: &grpc::LinuxResources) -> oci::LinuxResources
|
||||
swap: Some(mem.Swap),
|
||||
kernel: Some(mem.Kernel),
|
||||
kernel_tcp: Some(mem.KernelTCP),
|
||||
swappiness: Some(mem.Swappiness as i64),
|
||||
swappiness: Some(mem.Swappiness),
|
||||
disable_oom_killer: Some(mem.DisableOOMKiller),
|
||||
})
|
||||
} else {
|
||||
|
@@ -381,7 +381,7 @@ pub struct LinuxMemory {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none", rename = "kernelTCP")]
|
||||
pub kernel_tcp: Option<i64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub swappiness: Option<i64>,
|
||||
pub swappiness: Option<u64>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
|
@@ -400,7 +400,7 @@ fn memory_oci_to_ttrpc(
|
||||
Swap: mem.swap.unwrap_or(0),
|
||||
Kernel: mem.kernel.unwrap_or(0),
|
||||
KernelTCP: mem.kernel_tcp.unwrap_or(0),
|
||||
Swappiness: mem.swappiness.unwrap_or(0) as u64,
|
||||
Swappiness: mem.swappiness.unwrap_or(0),
|
||||
DisableOOMKiller: mem.disable_oom_killer.unwrap_or(false),
|
||||
unknown_fields: protobuf::UnknownFields::new(),
|
||||
cached_size: protobuf::CachedSize::default(),
|
||||
|
Reference in New Issue
Block a user