Module Name: src
Committed By: ad
Date: Fri Jan 17 20:27:28 UTC 2020
Modified Files:
src/sys/kern: kern_runq.c
Log Message:
sched_catchlwp(): fix an inverted test that could have caused performance
degradation.
To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/kern/kern_runq.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_runq.c
diff -u src/sys/kern/kern_runq.c:1.59 src/sys/kern/kern_runq.c:1.60
--- src/sys/kern/kern_runq.c:1.59 Mon Jan 13 11:53:24 2020
+++ src/sys/kern/kern_runq.c Fri Jan 17 20:27:28 2020
@@ -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 @@ sched_catchlwp(struct cpu_info *ci)
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;