Source-Changes-HG archive

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

src: Pull up following revision(s) (requested by hannken in tick...



details:   https://anonhg.NetBSD.org/src/rev/4c3b156f217c
branches:  netbsd-8
changeset: 318278:4c3b156f217c
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Apr 17 08:34:36 2018 +0000
description:
Pull up following revision(s) (requested by hannken in ticket #771):

        sys/kern/subr_pserialize.c: revision 1.11

Function pserialize_perform() usually succeeds after two cross calls
so defer kpause() to iterations three and above.

Speeds up VOP_REVOKE() on /proc/XXX/status by a factor of ~12.

Ok: core@

diffstat:

 sys/kern/subr_pserialize.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 2f78836e99b6 -r 4c3b156f217c sys/kern/subr_pserialize.c
--- a/sys/kern/subr_pserialize.c        Tue Apr 17 08:24:01 2018 +0000
+++ b/sys/kern/subr_pserialize.c        Tue Apr 17 08:34:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pserialize.c,v 1.8.10.2 2018/01/22 12:30:20 martin Exp $  */
+/*     $NetBSD: subr_pserialize.c,v 1.8.10.3 2018/04/17 08:34:36 martin Exp $  */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8.10.2 2018/01/22 12:30:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8.10.3 2018/04/17 08:34:36 martin Exp $");
 
 #include <sys/param.h>
 
@@ -146,6 +146,7 @@
 void
 pserialize_perform(pserialize_t psz)
 {
+       int n;
        uint64_t xc;
 
        KASSERT(!cpu_intr_p());
@@ -176,6 +177,7 @@
        TAILQ_INSERT_TAIL(&psz_queue0, psz, psz_chain);
        psz_work_todo++;
 
+       n = 0;
        do {
                mutex_spin_exit(&psz_lock);
 
@@ -183,9 +185,10 @@
                 * Force some context switch activity on every CPU, as
                 * the system may not be busy.  Pause to not flood.
                 */
+               if (n++ > 1)
+                       kpause("psrlz", false, 1, NULL);
                xc = xc_broadcast(XC_HIGHPRI, (xcfunc_t)nullop, NULL, NULL);
                xc_wait(xc);
-               kpause("psrlz", false, 1, NULL);
 
                mutex_spin_enter(&psz_lock);
        } while (!kcpuset_iszero(psz->psz_target));



Home | Main Index | Thread Index | Old Index