Source-Changes-HG archive

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

[src/pgoyette-localcount]: src/sys Instead of initializing the 'pserialize_t ...



details:   https://anonhg.NetBSD.org/src/rev/4521b47237fd
branches:  pgoyette-localcount
changeset: 852806:4521b47237fd
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Jul 17 21:39:17 2016 +0000

description:
Instead of initializing the 'pserialize_t psz' while holding a lock,
create a new devsw_detach_init() routine to hande this, and call it
after the pserialize system has been initialized.

diffstat:

 sys/kern/init_main.c  |   7 +++++--
 sys/kern/subr_devsw.c |  18 ++++++++++--------
 sys/sys/conf.h        |   3 ++-
 3 files changed, 17 insertions(+), 11 deletions(-)

diffs (91 lines):

diff -r 6da96dcd12ae -r 4521b47237fd sys/kern/init_main.c
--- a/sys/kern/init_main.c      Sun Jul 17 12:09:21 2016 +0000
+++ b/sys/kern/init_main.c      Sun Jul 17 21:39:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_main.c,v 1.482 2016/07/07 06:55:43 msaitoh Exp $  */
+/*     $NetBSD: init_main.c,v 1.482.2.1 2016/07/17 21:39:17 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.482 2016/07/07 06:55:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.482.2.1 2016/07/17 21:39:17 pgoyette Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -311,6 +311,9 @@
        /* Passive serialization. */
        pserialize_init();
 
+       /* Init the detach capability in devsw */
+       devsw_detach_init();
+
        /* Initialize the extent manager. */
        extent_init();
 
diff -r 6da96dcd12ae -r 4521b47237fd sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c     Sun Jul 17 12:09:21 2016 +0000
+++ b/sys/kern/subr_devsw.c     Sun Jul 17 21:39:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_devsw.c,v 1.34.2.5 2016/07/17 12:09:21 pgoyette Exp $     */
+/*     $NetBSD: subr_devsw.c,v 1.34.2.6 2016/07/17 21:39:17 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.5 2016/07/17 12:09:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.6 2016/07/17 21:39:17 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dtrace.h"
@@ -127,6 +127,13 @@
        cv_init(&device_cv, "devsw");
 }
 
+void
+devsw_detach_init(void)
+{
+
+       device_psz = pserialize_create();
+}
+
 int
 devsw_attach(const char *devname,
             const struct bdevsw *bdev, devmajor_t *bmajor,
@@ -397,12 +404,7 @@
        if (j < max_cdevsws )
                cdevsw[j] = NULL;
 
-       /*
-        * If we haven't already done so, create the serialization
-        * stucture.  Then wait for all current readers to finish.
-        */
-       if(__predict_false(device_psz == NULL))
-               device_psz = pserialize_create();
+       /* Wait for all current readers to finish with the devsw */
        pserialize_perform(device_psz);
 
        /*
diff -r 6da96dcd12ae -r 4521b47237fd sys/sys/conf.h
--- a/sys/sys/conf.h    Sun Jul 17 12:09:21 2016 +0000
+++ b/sys/sys/conf.h    Sun Jul 17 21:39:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.h,v 1.146.2.1 2016/07/16 07:54:13 pgoyette Exp $  */
+/*     $NetBSD: conf.h,v 1.146.2.2 2016/07/17 21:39:17 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -270,6 +270,7 @@
 };
 
 void devsw_init(void);
+void devsw_detach_init(void);
 const char *devsw_blk2name(devmajor_t);
 const char *cdevsw_getname(devmajor_t);
 const char *bdevsw_getname(devmajor_t);



Home | Main Index | Thread Index | Old Index