From 5a85bf2eb90ce9403f3f11e04ae3d5ba35db322a Mon Sep 17 00:00:00 2001
From: xuxuepeng <xuxuepeng1@huawei.com>
Date: Mon, 29 Apr 2024 05:44:44 +0800
Subject: [PATCH] Allow swappiness to be -1 as default

Signed-off-by: xuxuepeng <xuxuepeng1@huawei.com>
---
 src/agent/rustjail/src/cgroups/fs/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/agent/rustjail/src/cgroups/fs/mod.rs b/src/agent/rustjail/src/cgroups/fs/mod.rs
index 6145f5f..c49d041 100644
--- a/src/agent/rustjail/src/cgroups/fs/mod.rs
+++ b/src/agent/rustjail/src/cgroups/fs/mod.rs
@@ -475,7 +475,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)?;
-        } else {
+        } else if swappiness != (-1i64 as u64){
             return Err(anyhow!(
                 "invalid value:{}. valid memory swappiness range is 0-100",
                 swappiness
-- 
2.33.0

