git: 57cf5a9f0bec - stable/13 - sched_ule(4): Pre-seed sched_random().
Alexander Motin
mav at FreeBSD.org
Sat Aug 28 02:21:33 UTC 2021
The branch stable/13 has been updated by mav:
URL: https://cgit.FreeBSD.org/src/commit/?id=57cf5a9f0becc6d4b7cbdaad5be10ab28859b5ad
commit 57cf5a9f0becc6d4b7cbdaad5be10ab28859b5ad
Author: Alexander Motin <mav at FreeBSD.org>
AuthorDate: 2021-08-02 14:50:34 +0000
Commit: Alexander Motin <mav at FreeBSD.org>
CommitDate: 2021-08-28 02:17:56 +0000
sched_ule(4): Pre-seed sched_random().
I don't think it changes anything, but why not.
While there, make cpu_search_highest() use all 8 lower load bits for
noise, since it does not use cs_prefer and the code is not shared
with cpu_search_lowest() any more.
MFC after: 1 month
(cherry picked from commit ca34553b6f631ec4ec5ae9f3825e3196e172c35d)
---
sys/kern/sched_ule.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 3185ae3a6e1f..60f92a16f2e9 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -739,7 +739,7 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s,
if (l < s->cs_limit || !tdq->tdq_transferable ||
!CPU_ISSET(c, s->cs_mask))
continue;
- load -= sched_random() % 128;
+ load -= sched_random() % 256;
if (load > bload) {
bload = load;
r->cs_cpu = c;
@@ -1416,6 +1416,7 @@ sched_setup_smp(void)
tdq->tdq_cg = smp_topo_find(cpu_top, i);
if (tdq->tdq_cg == NULL)
panic("Can't find cpu group for %d\n", i);
+ DPCPU_ID_SET(i, randomval, i * 69069 + 5);
}
PCPU_SET(sched, DPCPU_PTR(tdq));
balance_tdq = TDQ_SELF();
More information about the dev-commits-src-all
mailing list