From 252800a70eaea6a65b9fd053f8e43e8389fe6448 Mon Sep 17 00:00:00 2001 From: hky1999 <976929993@qq.com> Date: Fri, 22 Nov 2024 16:25:25 +0800 Subject: [PATCH] [refactor]rename run_migrating to migration_entry --- modules/axtask/src/api.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/axtask/src/api.rs b/modules/axtask/src/api.rs index a0ba451ed9..80a080c68a 100644 --- a/modules/axtask/src/api.rs +++ b/modules/axtask/src/api.rs @@ -161,7 +161,7 @@ pub fn set_current_affinity(cpumask: AxCpuMask) -> bool { const MIGRATION_TASK_STACK_SIZE: usize = 4096; // Spawn a new migration task for migrating. let migration_task = TaskInner::new( - move || run_migrating(curr.clone()), + move || migrate_entry(curr.clone()), "migration-task".into(), MIGRATION_TASK_STACK_SIZE, ) @@ -169,6 +169,8 @@ pub fn set_current_affinity(cpumask: AxCpuMask) -> bool { // Migrate the current task to the correct CPU using the migration task. current_run_queue::().migrate_current(migration_task); + + assert!(cpumask.get(axhal::cpu::this_cpu_id()), "Migration failed"); } true } @@ -218,6 +220,6 @@ pub fn run_idle() -> ! { /// /// It calls `select_run_queue` to get the correct run queue for the task, and /// then puts the task to the run queue. -fn run_migrating(migrated_task: AxTaskRef) { +fn migrate_entry(migrated_task: AxTaskRef) { select_run_queue::(&migrated_task).put_prev_task(migrated_task); }