svn commit: r207288 - in user/kmacy/head_page_lock_2/sys: kern sys
Kip Macy
kmacy at FreeBSD.org
Tue Apr 27 19:44:07 UTC 2010
Author: kmacy
Date: Tue Apr 27 19:44:06 2010
New Revision: 207288
URL: http://svn.freebsd.org/changeset/base/207288
Log:
add separate lock class function for recursed mutexes
Modified:
user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
user/kmacy/head_page_lock_2/sys/kern/subr_lock.c
user/kmacy/head_page_lock_2/sys/sys/lock.h
Modified: user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c Tue Apr 27 18:41:16 2010 (r207287)
+++ user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c Tue Apr 27 19:44:06 2010 (r207288)
@@ -97,6 +97,7 @@ static void lock_spin(struct lock_object
static int owner_mtx(struct lock_object *lock, struct thread **owner);
#endif
static int unlock_mtx(struct lock_object *lock);
+static int unlock_recursable_mtx(struct lock_object *lock);
static int unlock_spin(struct lock_object *lock);
/*
@@ -111,6 +112,7 @@ struct lock_class lock_class_mtx_sleep =
#endif
.lc_lock = lock_mtx,
.lc_unlock = unlock_mtx,
+ .lc_unlock_recursable = unlock_recursable_mtx,
#ifdef KDTRACE_HOOKS
.lc_owner = owner_mtx,
#endif
@@ -185,6 +187,17 @@ unlock_mtx(struct lock_object *lock)
struct mtx *m;
m = (struct mtx *)lock;
+ mtx_assert(m, MA_NOTRECURSED|MA_OWNED);
+ mtx_unlock(m);
+ return (0);
+}
+
+int
+unlock_recursable_mtx(struct lock_object *lock)
+{
+ struct mtx *m;
+
+ m = (struct mtx *)lock;
mtx_assert(m, MA_OWNED);
mtx_unlock(m);
return (0);
Modified: user/kmacy/head_page_lock_2/sys/kern/subr_lock.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/kern/subr_lock.c Tue Apr 27 18:41:16 2010 (r207287)
+++ user/kmacy/head_page_lock_2/sys/kern/subr_lock.c Tue Apr 27 19:44:06 2010 (r207288)
@@ -714,7 +714,7 @@ ls_pop(struct lock_stack *ls)
ls->ls_top--;
lock = ls->ls_array[ls->ls_top].lse_lock;
class = ls->ls_array[ls->ls_top].lse_class;
- class->lc_unlock(lock);
+ class->lc_unlock_recursable(lock);
}
void
@@ -729,7 +729,7 @@ ls_popa(struct lock_stack *ls)
ls->ls_top--;
lock = ls->ls_array[ls->ls_top].lse_lock;
class = ls->ls_array[ls->ls_top].lse_class;
- class->lc_unlock(lock);
+ class->lc_unlock_recursable(lock);
}
}
Modified: user/kmacy/head_page_lock_2/sys/sys/lock.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/sys/lock.h Tue Apr 27 18:41:16 2010 (r207287)
+++ user/kmacy/head_page_lock_2/sys/sys/lock.h Tue Apr 27 19:44:06 2010 (r207288)
@@ -65,6 +65,7 @@ struct lock_class {
int (*lc_unlock)(struct lock_object *lock);
void (*lc_lock_full)(struct lock_object *lock, char *file, int line);
int (*lc_trylock)(struct lock_object *lock);
+ int (*lc_unlock_recursable)(struct lock_object *lock);
};
#define LC_SLEEPLOCK 0x00000001 /* Sleep lock. */
More information about the svn-src-user
mailing list