| Summary: | [patch] [sched] Remove random() from sched_ule, add short circuit for non-SMP, non-balancing | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Harrison Grundy <harrison.grundy> |
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | CC: | emaste, fidaj, imp, jmg, koobs |
| Priority: | --- | Keywords: | needs-qa, patch |
| Version: | CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
| URL: | https://github.com/AstrodogInc/freebsd_schedulers/blob/master/ule_patches/remove_random_in_balance.diff | ||
| Attachments: | |||
Created attachment 153415 [details]
Remove randomness entirely.
Some testing indicates that balancing here may not require any randomness at all.
Created attachment 153513 [details]
Creates sched_random, using the system used in cpu_search.
Another option.
If this doesn't work, I suppose we could put an actual PRNG in here, or bitshift get_cyclecount.
Do I understand correctly that now patch " Remove randomness entirely." is no longer needed? (In reply to Ivan Klymenko from comment #3) Each of the 3 patches solves the problem in a slightly different way. There's some discussion on -arch about which approach makes the most sense here, so I was planning to just leave them up until a decision is made. Created attachment 153514 [details]
Updated patch to create sched_random() to provide entropy in the scheduler.
Whoops. Forgot to have it "reseed". Thanks Konstantin Belousov.
Created attachment 153515 [details]
No randomness in scheduler at all
Created attachment 153516 [details]
Removes all scheduler randomness
Forgot the high group. One of those days...
sched_random() was committed in r279349 (by imp) and further refined afterwards. |
Created attachment 153317 [details] Replace random with get_cyclecount as a suitable source of entropy for the balancer. Short circuit for non-SMP/Balance As discovered by John-Mark Gurney, ULE uses random() which is not SMP/preemption safe. Move the check for SMP and Balancer being enabled above the generation of the balancing interval.