Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Aug 2021 14:55:33 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ca34553b6f63 - main - sched_ule(4): Pre-seed sched_random().
Message-ID:  <202108021455.172EtX31057284@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=ca34553b6f631ec4ec5ae9f3825e3196e172c35d

commit ca34553b6f631ec4ec5ae9f3825e3196e172c35d
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2021-08-02 14:50:34 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2021-08-02 14:55:28 +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
---
 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 1bdcfb1f793d..9bcc2a64e2b8 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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108021455.172EtX31057284>