From 26bc70f433e19fdda4fdbc380b51b153eac94278 Mon Sep 17 00:00:00 2001 From: Klaus Ma Date: Fri, 23 Jan 2026 01:09:41 +0000 Subject: [PATCH 1/4] fix: fix is_underused fn Signed-off-by: Klaus Ma --- session_manager/src/scheduler/plugins/mod.rs | 38 ++++++-------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/session_manager/src/scheduler/plugins/mod.rs b/session_manager/src/scheduler/plugins/mod.rs index d9f05b71..b6bfb9d6 100644 --- a/session_manager/src/scheduler/plugins/mod.rs +++ b/session_manager/src/scheduler/plugins/mod.rs @@ -92,7 +92,7 @@ impl PluginManager { Ok(plugins .values() - .all(|plugin| plugin.is_underused(ssn).unwrap_or(false))) + .any(|plugin| plugin.is_underused(ssn).unwrap_or(false))) } pub fn is_preemptible(&self, ssn: &SessionInfoPtr) -> Result { @@ -110,15 +110,9 @@ impl PluginManager { ) -> Result { let plugins = lock_ptr!(self.plugins)?; - for plugin in plugins.values() { - if let Some(available) = plugin.is_available(exec, ssn) { - if !available { - return Ok(false); - } - } - } - - Ok(true) + Ok(plugins + .values() + .all(|plugin| plugin.is_available(exec, ssn).unwrap_or(false))) } pub fn is_allocatable( @@ -128,29 +122,17 @@ impl PluginManager { ) -> Result { let plugins = lock_ptr!(self.plugins)?; - for plugin in plugins.values() { - if let Some(allocatable) = plugin.is_allocatable(node, ssn) { - if !allocatable { - return Ok(false); - } - } - } - - Ok(true) + Ok(plugins + .values() + .all(|plugin| plugin.is_allocatable(node, ssn).unwrap_or(false))) } pub fn is_reclaimable(&self, exec: &ExecutorInfoPtr) -> Result { let plugins = lock_ptr!(self.plugins)?; - for plugin in plugins.values() { - if let Some(reclaimable) = plugin.is_reclaimable(exec) { - if !reclaimable { - return Ok(false); - } - } - } - - Ok(true) + Ok(plugins + .values() + .all(|plugin| plugin.is_reclaimable(exec).unwrap_or(false))) } pub fn on_create_executor( From 021ad94b6b3b674602e40e16e659e563ba217811 Mon Sep 17 00:00:00 2001 From: Klaus Ma Date: Fri, 23 Jan 2026 09:20:44 +0800 Subject: [PATCH 2/4] Update session_manager/src/scheduler/plugins/mod.rs Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- session_manager/src/scheduler/plugins/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session_manager/src/scheduler/plugins/mod.rs b/session_manager/src/scheduler/plugins/mod.rs index b6bfb9d6..e3d9c77d 100644 --- a/session_manager/src/scheduler/plugins/mod.rs +++ b/session_manager/src/scheduler/plugins/mod.rs @@ -112,7 +112,7 @@ impl PluginManager { Ok(plugins .values() - .all(|plugin| plugin.is_available(exec, ssn).unwrap_or(false))) + .all(|plugin| plugin.is_available(exec, ssn).unwrap_or(true))) } pub fn is_allocatable( From ada8e0bc5b7372ad4420a4cfd6d21935ff1f8713 Mon Sep 17 00:00:00 2001 From: Klaus Ma Date: Fri, 23 Jan 2026 09:20:55 +0800 Subject: [PATCH 3/4] Update session_manager/src/scheduler/plugins/mod.rs Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- session_manager/src/scheduler/plugins/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session_manager/src/scheduler/plugins/mod.rs b/session_manager/src/scheduler/plugins/mod.rs index e3d9c77d..00491bb2 100644 --- a/session_manager/src/scheduler/plugins/mod.rs +++ b/session_manager/src/scheduler/plugins/mod.rs @@ -124,7 +124,7 @@ impl PluginManager { Ok(plugins .values() - .all(|plugin| plugin.is_allocatable(node, ssn).unwrap_or(false))) + .all(|plugin| plugin.is_allocatable(node, ssn).unwrap_or(true))) } pub fn is_reclaimable(&self, exec: &ExecutorInfoPtr) -> Result { From caf7ec66996a4dbf08038e6bfe97f4a5df7d99f2 Mon Sep 17 00:00:00 2001 From: Klaus Ma Date: Fri, 23 Jan 2026 09:21:08 +0800 Subject: [PATCH 4/4] Update session_manager/src/scheduler/plugins/mod.rs Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- session_manager/src/scheduler/plugins/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session_manager/src/scheduler/plugins/mod.rs b/session_manager/src/scheduler/plugins/mod.rs index 00491bb2..25e7c823 100644 --- a/session_manager/src/scheduler/plugins/mod.rs +++ b/session_manager/src/scheduler/plugins/mod.rs @@ -132,7 +132,7 @@ impl PluginManager { Ok(plugins .values() - .all(|plugin| plugin.is_reclaimable(exec).unwrap_or(false))) + .all(|plugin| plugin.is_reclaimable(exec).unwrap_or(true))) } pub fn on_create_executor(