Module Name:    src
Committed By:   pgoyette
Date:           Thu May 11 21:31:12 UTC 2017

Modified Files:
        src/sys/kern [prg-localcount2]: subr_localcount.c

Log Message:
Use kpreempt_{dis,en}able() rather than splsoftserial() for blocking
the local execution of the low-priority xcall.

Thanks to Kengo NAKAHARA for pointing this out.


To generate a diff of this commit:
cvs rdiff -u -r1.1.6.3 -r1.1.6.4 src/sys/kern/subr_localcount.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/subr_localcount.c
diff -u src/sys/kern/subr_localcount.c:1.1.6.3 src/sys/kern/subr_localcount.c:1.1.6.4
--- src/sys/kern/subr_localcount.c:1.1.6.3	Tue May  2 03:19:22 2017
+++ src/sys/kern/subr_localcount.c	Thu May 11 21:31:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_localcount.c,v 1.1.6.3 2017/05/02 03:19:22 pgoyette Exp $	*/
+/*	$NetBSD: subr_localcount.c,v 1.1.6.4 2017/05/11 21:31:12 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.1.6.3 2017/05/02 03:19:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.1.6.4 2017/05/11 21:31:12 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/localcount.h>
@@ -215,7 +215,6 @@ localcount_acquire(struct localcount *lc
 void
 localcount_release(struct localcount *lc, kcondvar_t *cv, kmutex_t *interlock)
 {
-	int s;
 
 	/*
 	 * Block xcall so that if someone begins draining after we see
@@ -227,7 +226,7 @@ localcount_release(struct localcount *lc
 	 * lc->lc_totalp as null, this CPU will not wake
 	 * localcount_drain.
 	 */
-	s = splsoftserial();
+	kpreempt_disable();
 
 	KDASSERT(mutex_ownable(interlock));
 	if (__predict_false(lc->lc_totalp != NULL)) {
@@ -245,5 +244,5 @@ localcount_release(struct localcount *lc
 	}
 
 	localcount_adjust(lc, -1);
-out:	splx(s);
+ out:	kpreempt_enable();
 }

Reply via email to