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(): break out of the loop earlier.



details:   https://anonhg.NetBSD.org/src/rev/36f3ac36b4e0
branches:  trunk
changeset: 467252:36f3ac36b4e0
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Jan 18 13:53:50 2020 +0000

description:
sched_bestcpu(): break out of the loop earlier.

diffstat:

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

diffs (44 lines):

diff -r 25487fbda8f8 -r 36f3ac36b4e0 sys/kern/kern_runq.c
--- a/sys/kern/kern_runq.c      Sat Jan 18 12:32:57 2020 +0000
+++ b/sys/kern/kern_runq.c      Sat Jan 18 13:53:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_runq.c,v 1.60 2020/01/17 20:27:28 ad Exp $        */
+/*     $NetBSD: kern_runq.c,v 1.61 2020/01/18 13:53:50 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.60 2020/01/17 20:27:28 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.61 2020/01/18 13:53:50 ad Exp $");
 
 #include "opt_dtrace.h"
 
@@ -487,6 +487,13 @@
                        }
 
                        curspc = &curci->ci_schedstate;
+
+                       /* If this CPU is idle and 1st class, we're done. */
+                       if ((curspc->spc_flags & (SPCF_IDLE | SPCF_1STCLASS)) ==
+                           (SPCF_IDLE | SPCF_1STCLASS)) {
+                               return curci;
+                       }
+
                        curpri = MAX(curspc->spc_curpriority,
                            curspc->spc_maxpriority);
 
@@ -512,11 +519,6 @@
                        bestci = curci;
                        bestspc = curspc;
 
-                       /* If this CPU is idle and 1st class, we're done. */
-                       if ((curspc->spc_flags & (SPCF_IDLE | SPCF_1STCLASS)) ==
-                           (SPCF_IDLE | SPCF_1STCLASS)) {
-                               break;
-                       }
                } while (curci = curci->ci_sibling[CPUREL_PACKAGE],
                    curci != outer);
        } while (outer = outer->ci_sibling[CPUREL_PACKAGE1ST],



Home | Main Index | Thread Index | Old Index