Source-Changes-HG archive

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

[src/trunk]: src/sys/kern proper locking for DEBUG



details:   https://anonhg.NetBSD.org/src/rev/9cfc3f7c7d1d
branches:  trunk
changeset: 781228:9cfc3f7c7d1d
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Aug 28 15:52:19 2012 +0000

description:
proper locking for DEBUG

diffstat:

 sys/kern/subr_pool.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 795c5987d134 -r 9cfc3f7c7d1d sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Tue Aug 28 15:22:18 2012 +0000
+++ b/sys/kern/subr_pool.c      Tue Aug 28 15:52:19 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.197 2012/06/05 22:51:47 jym Exp $      */
+/*     $NetBSD: subr_pool.c,v 1.198 2012/08/28 15:52:19 christos Exp $ */
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.197 2012/06/05 22:51:47 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.198 2012/08/28 15:52:19 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -462,6 +462,8 @@
        int off, slack;
 
 #ifdef DEBUG
+       if (__predict_true(!cold))
+               mutex_enter(&pool_head_lock);
        /*
         * Check that the pool hasn't already been initialised and
         * added to the list of all pools.
@@ -471,6 +473,8 @@
                        panic("pool_init: pool %s already initialised",
                            wchan);
        }
+       if (__predict_true(!cold))
+               mutex_exit(&pool_head_lock);
 #endif
 
        if (palloc == NULL)



Home | Main Index | Thread Index | Old Index