diff --git a/core/src/banking_stage.rs b/core/src/banking_stage.rs index 7108fa89901a5a..c8369cc9b38e9b 100644 --- a/core/src/banking_stage.rs +++ b/core/src/banking_stage.rs @@ -67,7 +67,7 @@ pub const FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET: u64 = 2; // Fixed thread size seems to be fastest on GCP setup pub const NUM_THREADS: u32 = 4; -const TOTAL_BUFFERED_PACKETS: usize = 500_000; +pub const TOTAL_BUFFERED_PACKETS: usize = 500_000; const MAX_NUM_TRANSACTIONS_PER_BATCH: usize = 128; diff --git a/core/src/tpu.rs b/core/src/tpu.rs index f26e0e32101453..1d3b826fed5155 100644 --- a/core/src/tpu.rs +++ b/core/src/tpu.rs @@ -2,7 +2,7 @@ //! multi-stage transaction processing pipeline in software. use crate::{ - banking_stage::BankingStage, + banking_stage::{BankingStage, TOTAL_BUFFERED_PACKETS}, broadcast_stage::{BroadcastStage, BroadcastStageType, RetransmitSlotsReceiver}, cluster_info::ClusterInfo, cluster_info_vote_listener::{ClusterInfoVoteListener, VerifiedVoteSender, VoteTracker}, @@ -19,6 +19,7 @@ use solana_runtime::{ bank_forks::BankForks, vote_sender_types::{ReplayVoteReceiver, ReplayVoteSender}, }; +use solana_streamer::packet::PACKETS_PER_BATCH; use std::{ net::UdpSocket, sync::{ @@ -67,7 +68,7 @@ impl Tpu { &exit, &packet_sender, &poh_recorder, - Some(TOTAL_BUFFERED_PACKETS), + Some((TOTAL_BUFFERED_PACKETS + PACKETS_PER_BATCH - 1) / PACKETS_PER_BATCH), ); let (verified_sender, verified_receiver) = unbounded(); diff --git a/perf/src/cuda_runtime.rs b/perf/src/cuda_runtime.rs index 3aa739af79eba7..dc9b84a0395ca2 100644 --- a/perf/src/cuda_runtime.rs +++ b/perf/src/cuda_runtime.rs @@ -66,9 +66,6 @@ pub struct PinnedVec { } impl Reset for PinnedVec { - fn len(&self) -> usize { - self.len() - } fn reset(&mut self) { self.resize(0, T::default()); } diff --git a/perf/src/recycler.rs b/perf/src/recycler.rs index 2f690f101bc5f1..5e94ed92bd6d01 100644 --- a/perf/src/recycler.rs +++ b/perf/src/recycler.rs @@ -49,7 +49,6 @@ impl RecyclerX { } pub trait Reset { - fn len(&self) -> usize; fn reset(&mut self); fn warm(&mut self, size_hint: usize); fn set_recycler(&mut self, recycler: Weak>) @@ -118,13 +117,11 @@ impl Recycler { let should_allocate = self .recycler .limit - .map(|limit| self.recycler.outstanding_len.load(Ordering::SeqCst) + t.len() <= limit) + .map(|limit| self.recycler.outstanding_len.load(Ordering::SeqCst) < limit) .unwrap_or(true); if should_allocate { t.set_recycler(Arc::downgrade(&self.recycler)); - self.recycler - .outstanding_len - .fetch_add(t.len(), Ordering::SeqCst); + self.recycler.outstanding_len.fetch_add(1, Ordering::SeqCst); Some(t) } else { None