Remove cpu_affinity field from OSTD Task struct

This commit is contained in:
jellllly420
2024-08-28 17:47:46 +08:00
committed by Tate, Hongliang Tian
parent 8927031426
commit 9cc63149f1
6 changed files with 29 additions and 27 deletions

View File

@ -19,7 +19,7 @@ pub use self::{
scheduler::info::{AtomicCpuId, TaskScheduleInfo},
};
pub(crate) use crate::arch::task::{context_switch, TaskContext};
use crate::{cpu::CpuSet, prelude::*, user::UserSpace};
use crate::{prelude::*, user::UserSpace};
/// A task that executes a function to the end.
///
@ -124,7 +124,6 @@ pub struct TaskOptions {
func: Option<Box<dyn Fn() + Send + Sync>>,
data: Option<Box<dyn Any + Send + Sync>>,
user_space: Option<Arc<UserSpace>>,
cpu_affinity: CpuSet,
}
impl TaskOptions {
@ -137,7 +136,6 @@ impl TaskOptions {
func: Some(Box::new(func)),
data: None,
user_space: None,
cpu_affinity: CpuSet::new_full(),
}
}
@ -165,15 +163,6 @@ impl TaskOptions {
self
}
/// Sets the CPU affinity mask for the task.
///
/// The `cpu_affinity` parameter represents
/// the desired set of CPUs to run the task on.
pub fn cpu_affinity(mut self, cpu_affinity: CpuSet) -> Self {
self.cpu_affinity = cpu_affinity;
self
}
/// Builds a new task without running it immediately.
pub fn build(self) -> Result<Task> {
/// all task will entering this function
@ -212,7 +201,6 @@ impl TaskOptions {
kstack,
schedule_info: TaskScheduleInfo {
cpu: AtomicCpuId::default(),
cpu_affinity: self.cpu_affinity,
},
};

View File

@ -4,8 +4,6 @@
use core::sync::atomic::{AtomicU32, Ordering};
use crate::cpu::CpuSet;
/// Fields of a task that OSTD will never touch.
///
/// The type ought to be defined by the OSTD user and injected into the task.
@ -17,8 +15,6 @@ use crate::cpu::CpuSet;
pub struct TaskScheduleInfo {
/// The CPU that the task would like to be running on.
pub cpu: AtomicCpuId,
/// The CPUs that this task can run on.
pub cpu_affinity: CpuSet,
}
/// An atomic CPUID container.