rt: rename shared to sharded in internal ShardedList (#8364)

This commit is contained in:
K-tecchan
2026-08-20 08:57:24 +02:00
committed by GitHub
parent 625954f365
commit ea91b33ca5
2 changed files with 8 additions and 8 deletions
+7 -7
View File
@@ -74,9 +74,9 @@ struct OwnedTasksInner<S: 'static> {
impl<S: 'static> OwnedTasks<S> { impl<S: 'static> OwnedTasks<S> {
pub(crate) fn new(num_cores: usize) -> Self { pub(crate) fn new(num_cores: usize) -> Self {
let shard_size = Self::gen_shared_list_size(num_cores); let sharded_size = Self::gen_sharded_list_size(num_cores);
Self { Self {
list: ShardedList::new(shard_size), list: ShardedList::new(sharded_size),
closed: AtomicBool::new(false), closed: AtomicBool::new(false),
id: get_next_id(), id: get_next_id(),
} }
@@ -224,11 +224,11 @@ impl<S: 'static> OwnedTasks<S> {
/// nodes in the intrusive linked list will diminish. Furthermore, /// nodes in the intrusive linked list will diminish. Furthermore,
/// the construction time of the sharded list will also increase with a higher number of shards. /// the construction time of the sharded list will also increase with a higher number of shards.
/// ///
/// Due to the above reasons, we set a maximum value for the shared list size, /// Due to the above reasons, we set a maximum value for the sharded list size,
/// denoted as `MAX_SHARED_LIST_SIZE`. /// denoted as `MAX_SHARDED_LIST_SIZE`.
fn gen_shared_list_size(num_cores: usize) -> usize { fn gen_sharded_list_size(num_cores: usize) -> usize {
const MAX_SHARED_LIST_SIZE: usize = 1 << 16; const MAX_SHARDED_LIST_SIZE: usize = 1 << 16;
usize::min(MAX_SHARED_LIST_SIZE, num_cores.next_power_of_two() * 4) usize::min(MAX_SHARDED_LIST_SIZE, num_cores.next_power_of_two() * 4)
} }
} }
+1 -1
View File
@@ -116,7 +116,7 @@ impl<L: ShardedListItem> ShardedList<L> {
self.len() == 0 self.len() == 0
} }
/// Gets the shard size of this `SharedList`. /// Gets the shard size of this `ShardedList`.
/// ///
/// Used to help us to decide the parameter `shard_id` of the `pop_back` method. /// Used to help us to decide the parameter `shard_id` of the `pop_back` method.
pub(crate) fn shard_size(&self) -> usize { pub(crate) fn shard_size(&self) -> usize {