perf(kernel): kernel static all-zero -> .bss (image 812K -> 173K): domain::Slot (repr(u8) Empty=0) for tables, zero generation counters, core ids by position, pool/platform installed at boot; Option-backed Slot under kani (cbmc speed); build fails if .data > 16K
This commit is contained in:
@@ -22,17 +22,9 @@ pub struct MultiCoreScheduler {
|
||||
|
||||
impl MultiCoreScheduler {
|
||||
pub const fn new(num_cores: u8) -> Self {
|
||||
let mut cores = [const { PerCoreScheduler::new(CoreId::from_raw(0)) }; MAX_CORES];
|
||||
// Each core numbered by its place (a const fn cannot index or map).
|
||||
let mut rest: &mut [PerCoreScheduler] = &mut cores;
|
||||
let mut id = 0u8;
|
||||
while let Some((core, tail)) = rest.split_first_mut() {
|
||||
*core = PerCoreScheduler::new(CoreId::from_raw(id));
|
||||
rest = tail;
|
||||
id += 1;
|
||||
}
|
||||
// A core is numbered by its place in `cores`.
|
||||
Self {
|
||||
cores,
|
||||
cores: [const { PerCoreScheduler::new() }; MAX_CORES],
|
||||
num_cores: if num_cores < MAX_CORES as u8 {
|
||||
num_cores
|
||||
} else {
|
||||
@@ -78,8 +70,8 @@ impl MultiCoreScheduler {
|
||||
pub fn queued_on(&self, thread: ThreadId) -> Option<CoreId> {
|
||||
self.active()
|
||||
.iter()
|
||||
.find(|c| c.is_queued(thread))
|
||||
.map(|c| c.core())
|
||||
.position(|c| c.is_queued(thread))
|
||||
.map(|i| CoreId::from_raw(i as u8))
|
||||
}
|
||||
|
||||
/// Whether `thread` waits in some core's run queue.
|
||||
|
||||
Reference in New Issue
Block a user