Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2012 18:05:16 +0000
From:      gmiller@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r237712 - soc2012/gmiller/locking-head/lib/libthr/thread
Message-ID:  <20120614180516.06AE2106566C@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gmiller
Date: Thu Jun 14 18:05:15 2012
New Revision: 237712
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237712

Log:
  Fix the remaining bug that caused wait times and contest counts to always
  be zero.
  

Modified:
  soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c
  soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h
  soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c

Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c	Thu Jun 14 17:54:52 2012	(r237711)
+++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c	Thu Jun 14 18:05:15 2012	(r237712)
@@ -751,11 +751,7 @@
 	struct pthread *curthread = _get_curthread();
 	uint32_t id;
 	int defered;
-#ifdef LOCK_PROFILING
-	struct timespec waittime;
 
-        bzero(&waittime, sizeof(waittime));
-#endif
 	if (__predict_false(m <= THR_MUTEX_DESTROYED)) {
 		if (m == THR_MUTEX_DESTROYED)
 			return (EINVAL);
@@ -775,10 +771,10 @@
 		m->m_count--;
 
 		if (m->m_count == 0) {
-			MUTEX_RELEASE(m, &waittime);
+			MUTEX_RELEASE(m);
 		}
 	} else {
-		MUTEX_RELEASE(m, &waittime);
+		MUTEX_RELEASE(m);
 
 		if ((m->m_flags & PMUTEX_FLAG_DEFERED) != 0) {
 			defered = 1;

Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h
==============================================================================
--- soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h	Thu Jun 14 17:54:52 2012	(r237711)
+++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h	Thu Jun 14 18:05:15 2012	(r237712)
@@ -767,8 +767,7 @@
 	    __hidden;
 void	_rwlock_release_write(struct pthread_rwlock *, struct timespec *)
 	    __hidden;
-void	_mutex_release(struct pthread_mutex *, struct timespec *,
-		       const char *file) __hidden;
+void	_mutex_release(struct pthread_mutex *, const char *file) __hidden;
 void	_spin_obtain_success(struct pthread_spinlock *,
 	    struct timespec *wait_time, const char *file, int line) __hidden;
 void	_spin_obtain_failed(struct pthread_spinlock *,
@@ -842,7 +841,7 @@
 		_mutex_obtain_success(m, ts, file, line)
 #define		MUTEX_OBTAIN_FAILED(m, ts)                                   \
 		_mutex_obtain_failed(m, ts, file)
-#define		MUTEX_RELEASE(m, ts)	_mutex_release(m, ts, file)
+#define		MUTEX_RELEASE(m)	_mutex_release(m, file)
 #define		RWLOCK_OBTAIN_READ_SUCCESS(l, ts)                            \
 		_rwlock_obtain_read_success(l, ts, file, line)
 #define		RWLOCK_OBTAIN_READ_FAILED(l, ts)                             \
@@ -866,7 +865,7 @@
 #define		LOCK_PROFILE_EXIT_THREAD(t)		do { } while (0)
 #define		MUTEX_OBTAIN_SUCCESS(m, ts)		do { } while (0)
 #define		MUTEX_OBTAIN_FAILED(m, ts)		do { } while (0)
-#define		MUTEX_RELEASE(m, ts)			do { } while (0)
+#define		MUTEX_RELEASE(m)			do { } while (0)
 #define		RWLOCK_OBTAIN_READ_SUCCESS(l, ts)	do { } while (0)
 #define		RWLOCK_OBTAIN_READ_FAILED(l, ts)	do { } while (0)
 #define		RWLOCK_OBTAIN_WRITE_SUCCESS(l, ts)	do { } while (0)

Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c	Thu Jun 14 17:54:52 2012	(r237711)
+++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c	Thu Jun 14 18:05:15 2012	(r237712)
@@ -173,8 +173,7 @@
 }
 
 void
-_mutex_release(struct pthread_mutex *m, struct timespec *wait_time,
-	       const char *file)
+_mutex_release(struct pthread_mutex *m, const char *file)
 {
 	struct pthread *curthread = _get_curthread();
 	struct acquisition *acq;
@@ -213,19 +212,19 @@
 					    &hold_time,
 					    sizeof(struct timespec));
 				}
-				if (TIMESPEC_GT(wait_time,
+				if (TIMESPEC_GT(&acq->wait_time,
 				    &acq_point->wait_max)) {
 					memcpy(&acq_point->wait_max,
-					    wait_time,
-					    sizeof(struct timespec));
+					       &acq->wait_time,
+					       sizeof(struct timespec));
 				}
 				TIMESPEC_ADD(&acq_point->hold_time,
 				    &acq_point->hold_time, &hold_time);
 				TIMESPEC_ADD(&acq_point->wait_time,
-				    &acq_point->wait_time, wait_time);
+				    &acq_point->wait_time, &acq->wait_time);
 				acq_point->acq_count += acq->count;
-				if (wait_time->tv_sec != 0 ||
-				    wait_time->tv_nsec != 0) {
+				if (acq->wait_time.tv_sec != 0 ||
+				    acq->wait_time.tv_nsec != 0) {
 					acq_point->contest_count++;
 				}
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120614180516.06AE2106566C>