diff --git a/bastion-executor/Cargo.toml b/bastion-executor/Cargo.toml index bec4b6ee..67e96d58 100644 --- a/bastion-executor/Cargo.toml +++ b/bastion-executor/Cargo.toml @@ -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" } diff --git a/bastion-executor/src/distributor.rs b/bastion-executor/src/distributor.rs index d3d2996a..d4e873dc 100644 --- a/bastion-executor/src/distributor.rs +++ b/bastion-executor/src/distributor.rs @@ -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 { diff --git a/bastion-executor/src/load_balancer.rs b/bastion-executor/src/load_balancer.rs index 78cc741b..68b910f6 100644 --- a/bastion-executor/src/load_balancer.rs +++ b/bastion-executor/src/load_balancer.rs @@ -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; /// diff --git a/bastion-executor/src/pool.rs b/bastion-executor/src/pool.rs index 79070ae0..217f2438 100644 --- a/bastion-executor/src/pool.rs +++ b/bastion-executor/src/pool.rs @@ -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; diff --git a/bastion-executor/src/run.rs b/bastion-executor/src/run.rs index 35881bcf..4a3d5757 100644 --- a/bastion-executor/src/run.rs +++ b/bastion-executor/src/run.rs @@ -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; diff --git a/bastion-executor/src/run_queue.rs b/bastion-executor/src/run_queue.rs index 5e7b7f60..41392dac 100644 --- a/bastion-executor/src/run_queue.rs +++ b/bastion-executor/src/run_queue.rs @@ -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; diff --git a/bastion-executor/src/worker.rs b/bastion-executor/src/worker.rs index 992d2307..d0191daf 100644 --- a/bastion-executor/src/worker.rs +++ b/bastion-executor/src/worker.rs @@ -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 diff --git a/lightproc/src/proc_stack.rs b/lightproc/src/proc_stack.rs index b71cbfda..3e068fc2 100644 --- a/lightproc/src/proc_stack.rs +++ b/lightproc/src/proc_stack.rs @@ -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;