Refactor code related to CPU local memory

Co-authored-by: Chuandong Li <lichuand@pku.edu.cn>
This commit is contained in:
Zhang Junyang
2024-06-28 15:47:01 +00:00
committed by Tate, Hongliang Tian
parent 98619f3482
commit 0f8d8da372
11 changed files with 339 additions and 185 deletions

View File

@ -4,7 +4,7 @@ use alloc::sync::Arc;
use core::time::Duration;
use aster_time::read_monotonic_time;
use ostd::{arch::timer::Jiffies, cpu_local, sync::SpinLock, CpuLocal};
use ostd::{arch::timer::Jiffies, cpu_local, sync::SpinLock};
use paste::paste;
use spin::Once;
@ -215,9 +215,7 @@ macro_rules! define_timer_managers {
let clock = paste! {[<$clock_id _INSTANCE>].get().unwrap().clone()};
let clock_manager = TimerManager::new(clock);
paste! {
CpuLocal::borrow_with(&[<$clock_id _MANAGER>], |manager| {
manager.call_once(|| clock_manager.clone());
});
[<$clock_id _MANAGER>].call_once(|| clock_manager.clone());
}
let callback = move || {
clock_manager.process_expired_timers();