Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern sched_bestcpu(): There is a fallback CPU, in case t...



details:   https://anonhg.NetBSD.org/src/rev/b5620a6e6810
branches:  trunk
changeset: 933277:b5620a6e6810
user:      ad <ad%NetBSD.org@localhost>
date:      Sat May 23 21:14:55 2020 +0000

description:
sched_bestcpu(): There is a fallback CPU, in case the user manages to set
the system up so no CPU is permitted to run a given LWP.  Fix a bug where
that fallback CPU would sometimes get picked even if there was another CPU
that could legitimately run the LWP.

diffstat:

 sys/kern/kern_runq.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r ae104919fdbd -r b5620a6e6810 sys/kern/kern_runq.c
--- a/sys/kern/kern_runq.c      Sat May 23 20:45:10 2020 +0000
+++ b/sys/kern/kern_runq.c      Sat May 23 21:14:55 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_runq.c,v 1.67 2020/04/13 16:09:21 maxv Exp $      */
+/*     $NetBSD: kern_runq.c,v 1.68 2020/05/23 21:14:55 ad Exp $        */
 
 /*-
  * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.67 2020/04/13 16:09:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.68 2020/05/23 21:14:55 ad Exp $");
 
 #include "opt_dtrace.h"
 
@@ -479,7 +479,13 @@
         */
        bestci = pivot;
        bestspc = &bestci->ci_schedstate;
-       bestpri = MAX(bestspc->spc_curpriority, bestspc->spc_maxpriority);
+       if (sched_migratable(l, bestci)) {
+               bestpri = MAX(bestspc->spc_curpriority,
+                   bestspc->spc_maxpriority);
+       } else {
+               /* Invalidate the priority. */
+               bestpri = PRI_COUNT;
+       }
 
        /* In the outer loop scroll through all CPU packages. */
        pivot = pivot->ci_package1st;



Home | Main Index | Thread Index | Old Index