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.
This commit is contained in:
Mark Rousskov 2020-01-15 20:35:51 -05:00
parent 0d722a4d83
commit b448d92399

View File

@ -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");