List:Commits« Previous MessageNext Message »
From:Sunny Bains Date:April 28 2010 10:02am
Subject:bzr commit into mysql-trunk-innodb branch (Sunny.Bains:3044)
View as plain text  
#At file:///Users/sunny/innodb/bzr/mysql-trunk-innodb/ based on revid:sunny.bains@stripped

 3044 Sunny Bains	2010-04-28
      Move fields that are simply incremented or decremented using a simple
      covering mutex to use atomics when available otherwise use the old mutex.

    modified:
      storage/innobase/row/row0purge.c
      storage/innobase/trx/trx0purge.c
=== modified file 'storage/innobase/row/row0purge.c'
--- a/storage/innobase/row/row0purge.c	revid:sunny.bains@stripped
+++ b/storage/innobase/row/row0purge.c	revid:sunny.bains@stripped
@@ -769,14 +769,7 @@ row_purge_end(
 
 	mem_heap_empty(node->heap);
 
-	os_atomic_increment(&purge_sys->n_completed, 1);
-#if 0
-	printf("%10lu: %p: %lu:%lu\n",
-		os_thread_pf(os_thread_get_curr_id()),
-		node, 
-		purge_sys->n_submitted,
-	       	purge_sys->n_completed);
-#endif
+	os_atomic_inc_ulint(&purge_sys->mutex, &purge_sys->n_completed, 1);
 }
 
 /***********************************************************//**

=== modified file 'storage/innobase/trx/trx0purge.c'
--- a/storage/innobase/trx/trx0purge.c	revid:sunny.bains@stripped
+++ b/storage/innobase/trx/trx0purge.c	revid:sunny.bains@stripped
@@ -131,9 +131,7 @@ trx_purge_arr_set_info(
 		cell->undo_no = undo_no;
 	}
 
-	purge_mutex_enter();
-	++purge_sys->arr->n_used;
-	purge_mutex_exit();
+	os_atomic_inc_ulint(&purge_sys->mutex, &purge_sys->arr->n_used, 1);
 
 	return(cell);
 }
@@ -154,9 +152,7 @@ trx_purge_arr_clear_info(
 		memset(cell, 0x0, sizeof(*cell));
 	}
 
-	purge_mutex_enter();
-	--purge_sys->arr->n_used;
-	purge_mutex_exit();
+	os_atomic_dec_ulint(&purge_sys->mutex, &purge_sys->arr->n_used, 1);
 }
 
 /*******************************************************************//**
@@ -1271,7 +1267,9 @@ trx_purge(
 
 			ut_a(thr != NULL);
 
-			os_atomic_increment(&purge_sys->n_submitted, 1);
+			os_atomic_inc_ulint(
+				&purge_sys->mutex,
+			       	&purge_sys->n_submitted, 1);
 
 			srv_que_task_enqueue_low(thr);
 		}
@@ -1285,7 +1283,8 @@ trx_purge(
 		thr = que_fork_start_command(purge_sys->query);
 		ut_ad(thr);
 
-		os_atomic_increment(&purge_sys->n_submitted, 1);
+		os_atomic_inc_ulint(
+			&purge_sys->mutex, &purge_sys->n_submitted, 1);
 
 		que_run_threads(thr);
 


Attachment: [text/bzr-bundle] bzr/sunny.bains@oracle.com-20100428100026-sm5rtpz0o7bhy9z0.bundle
Thread
bzr commit into mysql-trunk-innodb branch (Sunny.Bains:3044) Sunny Bains28 Apr