Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix statistics in case mi_switch didn't actually sw...



details:   https://anonhg.NetBSD.org/src/rev/20fff03b808b
branches:  trunk
changeset: 446227:20fff03b808b
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Wed Nov 28 09:44:49 2018 +0000

description:
Fix statistics in case mi_switch didn't actually switch LWPs.

diffstat:

 sys/kern/kern_synch.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 8d380b237eb2 -r 20fff03b808b sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Wed Nov 28 09:16:19 2018 +0000
+++ b/sys/kern/kern_synch.c     Wed Nov 28 09:44:49 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.318 2018/08/14 01:06:01 ozaki-r Exp $ */
+/*     $NetBSD: kern_synch.c,v 1.319 2018/11/28 09:44:49 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.318 2018/08/14 01:06:01 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.319 2018/11/28 09:44:49 mlelstv Exp $");
 
 #include "opt_kstack.h"
 #include "opt_dtrace.h"
@@ -292,7 +292,12 @@
        KASSERT(l->l_stat == LSONPROC);
        l->l_kpriority = false;
        l->l_nivcsw++;
-       (void)mi_switch(l);
+       if (mi_switch(l) == 0) {
+               /* we didn't switch */
+               lwp_lock(l);
+               l->l_nivcsw--;
+               lwp_unlock(l);
+       }
        KERNEL_LOCK(l->l_biglocks, l);
 }
 



Home | Main Index | Thread Index | Old Index