Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Mar 24, 2015

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit dac499a01d1958781e526df982d78d733f19c527:

Cpu clock does not wrap if there is no CPU clock (2015-03-20 10:29:29 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 40c666c87c2d7751abea8fc2f866404d1efbdee2:

Always update rusage before grabbing stat_mutex (2015-03-23 10:19:44 -0600)

----------------------------------------------------------------
Jens Axboe (1):
Always update rusage before grabbing stat_mutex

 backend.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

---

Diff of recent changes:

backend.c +14 -0
index fdb7413..2be7149 100644
@@ -1526,6 +1526,15 @@ static void *thread_main(void *data)
 
 		clear_state = 1;
 
+		/*
+		 * Make sure we've successfully updated the rusage stats
+		 * before waiting on the stat mutex. Otherwise we could have
+		 * the stat thread holding stat mutex and waiting for
+		 * the rusage_sem, which would never get upped because
+		 * this thread is waiting for the stat mutex.
+		 */
+		check_update_rusage(td);
+
 		fio_mutex_down(stat_mutex);
 		if (td_read(td) && td->io_bytes[DDIR_READ]) {
 			elapsed = mtime_since_now(&td->start);
@@ -1556,6 +1565,11 @@ static void *thread_main(void *data)
 
 		do_verify(td, verify_bytes);
 
+		/*
+		 * See comment further up for why this is done here.
+		 */
+		check_update_rusage(td);
+
 		fio_mutex_down(stat_mutex);
 		td->ts.runtime[DDIR_READ] += mtime_since_now(&td->start);
 		fio_gettime(&td->start, NULL);