Repository navigation
Conversation
|
This PR modifies If appropriate, please update This PR modifies If appropriate, please update |
|
Thanks for the pull request, and welcome! The Rust Project has assigned @clubby789 (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. Why was this reviewer chosen?The reviewer was selected based on:
|
|
Change tracker entry probably not necessary, as elaborated above. |
|
On second thought, maybe it's worth telling people to get rid of things like |
|
I have never once heard of anyone using such an alias. |
|
Would it make sense to disable this on the dist profile? Otherwise on systems building multiple packages at the same time we might unnecessarily get slowed down. |
|
@bjorn3 Refer to case 4:
"We" might get unnecessarily "slowed down", but that is not a bad thing, unless you are presuming that those running the (as mentioned previously, inefficient and misguided) cross-package-parallel build are measuring the wall time (as opposed to the CPU time) of the Rust build and drawing unsavory conclusions from that. You can't save people with horrible benchmarks from themselves. |
|
Increasing wall time means that it takes longer between updating the package definition for rustc and the update actually being available to end users or to build other packages, even if cpu time is identical. And given that rustc already takes a while to build (and is a dependency of other projects that are slow to build, like firefox), making it even longer to build seems bad. |
|
I agree that building packages without handling your own priorities if you care about ordering seems like a "you" problem, but I also agree that there's no reason to have rustc nice its own build when we would, logically, mostly be competing against "peers" of rustc. A dist build should probably avoid trying to take part in prioritization on the assumption that the larger system has handled that. |
|
Let's say we have two jobs A and R, where R is the Rust build, being started at the same time, and a job B, which waits for R to finish. Consider the asymptotic starvation behavior: A runs while R gets exactly zero CPU time; R then gets all of the CPU time for itself and completes faster than if it was competing for time (but the wall time will make it look slower, because the timer starts when A and R start, not when A finishes and R begins receiving CPU time). Subsequently, B will get the CPU all to itself, which will only result in CPU sleep compared to equal scheduling if B cannot parallelize. Note that CPU sleeping during execution of B is also possible in the equal scheduling case if A and R complete sooner. All of this is to say that situations in which rustc being deprioritized could significantly delay the build are very exotic. It would be like trying to rely on pipelining facilitated by build planning when the planning algorithm is "if we can start running a thing, do it". Although, at the same time, the kinds of workflows that run dist builds often involve nicing the whole build at a higher level (like a I think I'll special-case dist builds when I get home. I would much prefer if there was some protocol for non-interactive batch job managers to tell their children that they shouldn't auto-prioritize, maybe like a |
Yes, exactly. That "should" be happening, so fiddling with our priority in the dist case seems like it just "gets in the way", even if
in a more perfect world we would have this, yes. |
The
low-priorityoption is tucked away so far inbootstrap.example.tomlthat it's nearly impossible to discover by anyone who doesn't think they're doing anything niche (see #165702). However, it is beneficial to have it enabled on nearly every system, since a build is a CPU-saturating batch job that has no business preempting foreground applications, which predominantly have nice 0. Consider the following three scenarios ensuing from the change fromlow-priority = "false"tolow-priority = "true":low-priority = "false"override as a hacky stopgap if it is desirable for the bootstrap build to engage in disruptive competition for resources and win against some other batch job running in parallel.Some may wonder why agonizing over this is necessary to begin with if this is such a clear-cut case that operating systems are supposed to deal with automatically. The answer is that the operating systems of today are still not very good at making this sort of scheduling decision in that their capacity to implement such logic automatically is limited and non-robust in unintuitive ways.
For example, the automatic prioritization of foreground programs for scheduling purposes in Windows, known as quantum boosting, can only confer priority boosts to the threads of the process that owns a foreground window, which means that if the graphical application displayed within that window has an IPC dependency on a different process (as is the case with the likes of Jupyter notebooks and even regular web browsers), that dependency will not receive the quantum boost or any other kind of priority increase.
On Linux, meanwhile, no such heuristics exist to begin with (due to graphical applications not holding any special status in the scheduler), and the only mechanism to prevent CPU-intensive and CPU-saturating batch jobs from preempting foreground applications is the emergent heuristic of completely fair scheduling, in which tasks with less total CPU time accrued will have higher priority. This is even more flawed than quantum boosting on Windows, as long-running graphical applications will easily get preempted for long periods of time by the constantly spawning rustc processes of a build that have no history of high CPU usage.
In summary: there are commonly occurring setups on which this change is beneficial, commonly occurring setups on which this change does nothing, and extremely niche and typically broken use cases where this change does something that cannot be conclusively deemed positive or negative.
Large language models were not used in the production of this PR.