Skip to content

Commit

Permalink
Cleaned up bastion-executor and lightproc's dependencies imports and …
Browse files Browse the repository at this point in the history
…replaced rustc_hash with fxhash.
  • Loading branch information
r3v2d0g committed Nov 13, 2019
1 parent 0d45934 commit ed7c634
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 44 deletions.
2 changes: 1 addition & 1 deletion bastion-executor/Cargo.toml
Expand Up @@ -22,10 +22,10 @@ unstable = ["numanji", "allocator-suite", "jemallocator"]
[dependencies]
crossbeam-utils = "0.6"
crossbeam-epoch = "0.7"
fxhash = "0.2"
lazy_static = "1.4"
libc = "0.2"
num_cpus = "1.10"
rustc-hash = "1.0.1"
pin-utils = "0.1.0-alpha.4"
lightproc = { version = "= 0.3.3-alpha.1", "path" = "../lightproc" }

Expand Down
9 changes: 3 additions & 6 deletions bastion-executor/src/distributor.rs
Expand Up @@ -3,13 +3,10 @@
//!
//! Distributor provides a fair distribution of threads and pinning them to cores for fair execution.
//! It assigns threads in round-robin fashion to all cores.
use super::placement;
use super::placement::CoreId;
use super::run_queue::{Stealer, Worker};

use lightproc::prelude::*;

use crate::placement::{self, CoreId};
use crate::run_queue::{Stealer, Worker};
use crate::worker;
use lightproc::prelude::*;
use std::thread;

pub(crate) struct Distributor {
Expand Down
11 changes: 4 additions & 7 deletions bastion-executor/src/load_balancer.rs
Expand Up @@ -4,15 +4,12 @@
//! Load balancer calculates sampled mean to provide average process execution amount
//! to all runtime.
//!

use super::placement;
use crate::load_balancer;
use crate::placement;
use crossbeam_utils::sync::ShardedLock;
use fxhash::FxHashMap;
use lazy_static::*;

use std::thread;

use super::load_balancer;
use crossbeam_utils::sync::ShardedLock;
use rustc_hash::FxHashMap;
use std::time::Duration;

///
Expand Down
12 changes: 5 additions & 7 deletions bastion-executor/src/pool.rs
Expand Up @@ -4,13 +4,11 @@
//! Pool management and tracking belongs here.
//! We spawn futures onto the pool with [spawn] method of global run queue or
//! with corresponding [Worker]'s spawn method.

use super::distributor::Distributor;

use super::run_queue::{Injector, Stealer};
use super::sleepers::Sleepers;
use super::worker;
use lazy_static::*;
use crate::distributor::Distributor;
use crate::run_queue::{Injector, Stealer};
use crate::sleepers::Sleepers;
use crate::worker;
use lazy_static::lazy_static;
use lightproc::prelude::*;
use std::future::Future;

Expand Down
5 changes: 2 additions & 3 deletions bastion-executor/src/run.rs
Expand Up @@ -2,11 +2,10 @@
//! Blocking run of the async processes
//!
//!
use super::worker;
use crate::worker;
use crossbeam_utils::sync::Parker;
use lightproc::proc_stack::ProcStack;
use std::cell::Cell;
use std::cell::UnsafeCell;
use std::cell::{Cell, UnsafeCell};
use std::future::Future;
use std::mem::ManuallyDrop;
use std::pin::Pin;
Expand Down
13 changes: 3 additions & 10 deletions bastion-executor/src/run_queue.rs
Expand Up @@ -51,22 +51,15 @@
//! [`steal()`]: struct.Stealer.html#method.steal
//! [`steal_batch()`]: struct.Stealer.html#method.steal_batch
//! [`steal_batch_and_pop()`]: struct.Stealer.html#method.steal_batch_and_pop

extern crate crossbeam_epoch as epoch;
extern crate crossbeam_utils as utils;

use crossbeam_epoch::{self as epoch, Atomic, Owned};
use crossbeam_utils::{Backoff, CachePadded};
use std::cell::{Cell, UnsafeCell};
use std::cmp;
use std::fmt;
use std::iter::FromIterator;
use std::marker::PhantomData;
use std::mem::{self, ManuallyDrop};
use std::ptr;
use std::sync::atomic::{self, AtomicIsize, AtomicPtr, AtomicUsize, Ordering};
use std::sync::Arc;

use epoch::{Atomic, Owned};
use utils::{Backoff, CachePadded};
use std::{cmp, fmt, ptr};

// Minimum buffer capacity.
const MIN_CAP: usize = 64;
Expand Down
13 changes: 4 additions & 9 deletions bastion-executor/src/worker.rs
Expand Up @@ -3,17 +3,12 @@
//!
//! This worker implementation relies on worker run queue statistics which are hold in the pinned global memory
//! where workload distribution calculated and amended to their own local queues.

use std::cell::{Cell, UnsafeCell};
use std::ptr;

use super::pool;
use super::run_queue::Worker;
use crate::load_balancer;
use crate::pool::Pool;
use crate::run_queue::Steal;
use core::iter;
use crate::pool::{self, Pool};
use crate::run_queue::{Steal, Worker};
use lightproc::prelude::*;
use std::cell::{Cell, UnsafeCell};
use std::{iter, ptr};

///
/// Get the current process's stack
Expand Down
1 change: 0 additions & 1 deletion lightproc/src/proc_stack.rs
Expand Up @@ -5,7 +5,6 @@
//!
//! If we want to make an analogy, stack abstraction is similar to actor lifecycle abstractions
//! in frameworks like Akka, but tailored version for Rust environment.

use std::fmt::{self, Debug, Formatter};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
Expand Down

0 comments on commit ed7c634

Please sign in to comment.