Source-Changes-HG archive

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

[src/trunk]: src/sys/kern turnstile_block: reduce code duplication.



details:   https://anonhg.NetBSD.org/src/rev/c87f69d8778f
branches:  trunk
changeset: 749118:c87f69d8778f
user:      yamt <yamt%NetBSD.org@localhost>
date:      Wed Nov 18 12:26:22 2009 +0000

description:
turnstile_block: reduce code duplication.

diffstat:

 sys/kern/kern_turnstile.c |  16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diffs (41 lines):

diff -r 5017d5ce34f0 -r c87f69d8778f sys/kern/kern_turnstile.c
--- a/sys/kern/kern_turnstile.c Wed Nov 18 12:25:15 2009 +0000
+++ b/sys/kern/kern_turnstile.c Wed Nov 18 12:26:22 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_turnstile.c,v 1.27 2009/11/18 12:25:15 yamt Exp $ */
+/*     $NetBSD: kern_turnstile.c,v 1.28 2009/11/18 12:26:22 yamt Exp $ */
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_turnstile.c,v 1.27 2009/11/18 12:25:15 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_turnstile.c,v 1.28 2009/11/18 12:26:22 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/lockdebug.h>
@@ -295,21 +295,11 @@
                         */
                        break;
                }
-
-               if (l == owner) {
-                       /* owner has changed, restart from curlwp */
-                       lwp_unlock(l);
-                       l = cur;
-                       lwp_lock(l);
-                       prio = lwp_eprio(l);
-                       continue;
-               }
-                       
                if (l->l_mutex != owner->l_mutex)
                        dolock = true;
                else
                        dolock = false;
-               if (dolock && !lwp_trylock(owner)) {
+               if (l == owner || (dolock && !lwp_trylock(owner))) {
                        /*
                         * restart from curlwp.
                         * Note that there may be a livelock here:



Home | Main Index | Thread Index | Old Index