Module Name: src
Committed By: bouyer
Date: Tue Jul 24 15:09:37 UTC 2018
Modified Files:
src/sys/kern: kern_synch.c
Log Message:
In mi_switch(), also call pserialize_switchpoint() if we're not switching
to another lwp, as proposed on
http://mail-index.netbsd.org/tech-kern/2018/07/20/msg023709.html
Without it, on a SMP machine with few processes running (e.g while
running sysinst), pserialize could hang for a long time until all
CPUs got a LWP to run (or, eventually, forever).
Tested on Xen domUs with 4 CPUs, and on a 64-threads AMD machine.
To generate a diff of this commit:
cvs rdiff -u -r1.316 -r1.317 src/sys/kern/kern_synch.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_synch.c
diff -u src/sys/kern/kern_synch.c:1.316 src/sys/kern/kern_synch.c:1.317
--- src/sys/kern/kern_synch.c:1.316 Thu Jul 12 10:46:48 2018
+++ src/sys/kern/kern_synch.c Tue Jul 24 15:09:37 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_synch.c,v 1.316 2018/07/12 10:46:48 maxv Exp $ */
+/* $NetBSD: kern_synch.c,v 1.317 2018/07/24 15:09:37 bouyer 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.316 2018/07/12 10:46:48 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.317 2018/07/24 15:09:37 bouyer Exp $");
#include "opt_kstack.h"
#include "opt_dtrace.h"
@@ -745,6 +745,7 @@ mi_switch(lwp_t *l)
retval = 1;
} else {
/* Nothing to do - just unlock and return. */
+ pserialize_switchpoint();
mutex_spin_exit(spc->spc_mutex);
lwp_unlock(l);
retval = 0;