Source-Changes-HG archive

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

[src/trunk]: src/sys/kern sched_catchlwp(): fix an inverted test that could h...



details:   https://anonhg.NetBSD.org/src/rev/85c55f488ade
branches:  trunk
changeset: 467218:85c55f488ade
user:      ad <ad%NetBSD.org@localhost>
date:      Fri Jan 17 20:27:28 2020 +0000

description:
sched_catchlwp(): fix an inverted test that could have caused performance
degradation.

diffstat:

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

diffs (37 lines):

diff -r d72109387eb8 -r 85c55f488ade sys/kern/kern_runq.c
--- a/sys/kern/kern_runq.c      Fri Jan 17 20:26:22 2020 +0000
+++ b/sys/kern/kern_runq.c      Fri Jan 17 20:27:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_runq.c,v 1.59 2020/01/13 11:53:24 ad Exp $        */
+/*     $NetBSD: kern_runq.c,v 1.60 2020/01/17 20:27:28 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.59 2020/01/13 11:53:24 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.60 2020/01/17 20:27:28 ad Exp $");
 
 #include "opt_dtrace.h"
 
@@ -631,13 +631,13 @@
        spc = &ci->ci_schedstate;
 
        /*
-        * Be more aggressive if this CPU is first class, and the other is
-        * not.
+        * Be more aggressive if this CPU is first class, and the other
+        * is not.
         */
-       gentle = ((curspc->spc_flags & SPCF_1STCLASS) != 0 &&
-           (spc->spc_flags & SPCF_1STCLASS) == 0);
+       gentle = ((curspc->spc_flags & SPCF_1STCLASS) == 0 ||
+           (spc->spc_flags & SPCF_1STCLASS) != 0);
 
-       if ((gentle && spc->spc_mcount < min_catch) ||
+       if (spc->spc_mcount < (gentle ? min_catch : 1) ||
            curspc->spc_psid != spc->spc_psid) {
                spc_unlock(ci);
                return NULL;



Home | Main Index | Thread Index | Old Index