From b448d92399c1bf67b8d135267d052cf93b2164ab Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 15 Jan 2020 20:35:51 -0500 Subject: [PATCH] Do not send acquired tokens to waiting rustc threads This removes the ad-hoc token re-send in the message processing; this sort of decision should be left up to the main loop which manages tokens. Notably, the behavior change here is that new tokens will go solely to spawning new rustc *processes* rather than increasing rustc internal parallelism, unless we can't spawn new processes. Otherwise, before this commit, we may be saturating a single rustc with tokens rather than creating lots of rustcs that can work in parallel. In particular in the beginning of a build, it's likely that this is worse (i.e., crates are small and rustc internal parallelism is not at that point all that helpful) since it severely limits the benefits of pipelining and generally makes the build nearly serial. --- src/cargo/core/compiler/job_queue.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/cargo/core/compiler/job_queue.rs b/src/cargo/core/compiler/job_queue.rs index ff29bfaa3..fa8bee9b4 100644 --- a/src/cargo/core/compiler/job_queue.rs +++ b/src/cargo/core/compiler/job_queue.rs @@ -478,14 +478,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> { } Message::Token(acquired_token) => { let token = acquired_token.chain_err(|| "failed to acquire jobserver token")?; - if let Some((id, client)) = self.to_send_clients.pop() { - self.rustc_tokens.push((id, token)); - client - .release_raw() - .chain_err(|| "failed to release jobserver token")?; - } else { - self.tokens.push(token); - } + self.tokens.push(token); } Message::NeedsToken(id, client) => { log::info!("queue token request");