Skip to content

Commit

Permalink
Fetch cores at once, rely on runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexclique committed Dec 3, 2019
1 parent 1e580af commit 5c52042
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion bastion-executor/src/load_balancer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl LoadBalancer {
.smp_queues
.values()
.sum::<usize>()
.wrapping_div(placement::get_core_ids().unwrap().len());
.wrapping_div(*core_retrieval());
}

// Try sleeping for a while to wait
Expand Down Expand Up @@ -85,3 +85,14 @@ pub fn stats() -> &'static ShardedLock<Stats> {
}
&*LB_STATS
}

///
/// Retrieve core count for the runtime scheduling purposes
#[inline]
pub fn core_retrieval() -> &'static usize {
lazy_static! {
static ref CORE_COUNT: usize = { placement::get_core_ids().unwrap().len() };
}

&*CORE_COUNT
}
2 changes: 1 addition & 1 deletion bastion/src/broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl Broadcast {
}

pub(crate) fn send_children(&self, msg: BastionMessage) {
for (_, child) in &self.children {
for child in self.children.values() {
// FIXME: Err(Error) if None
if let Some(msg) = msg.try_clone() {
// FIXME: handle errors
Expand Down

0 comments on commit 5c52042

Please sign in to comment.