List:Commits« Previous MessageNext Message »
From:knielsen Date:October 12 2007 11:23am
Subject:bk commit into 5.1 tree (knielsen:1.2617)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of knielsen. When knielsen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-10-12 13:23:37+02:00, knielsen@ymer.(none) +1 -0
  Reduce lock contention printout.
  Disable lock-to-cpu.

  storage/ndb/src/kernel/vm/mt/mt.cpp@stripped, 2007-10-12 13:23:31+02:00, knielsen@ymer.(none) +17 -2
    Reduce lock contention printout.
    Disable lock-to-cpu.

diff -Nrup a/storage/ndb/src/kernel/vm/mt/mt.cpp b/storage/ndb/src/kernel/vm/mt/mt.cpp
--- a/storage/ndb/src/kernel/vm/mt/mt.cpp	2007-10-12 07:45:23 +02:00
+++ b/storage/ndb/src/kernel/vm/mt/mt.cpp	2007-10-12 13:23:31 +02:00
@@ -141,9 +141,15 @@ inline void require(bool x)
 
 struct thr_spin_lock
 {
-  thr_spin_lock(const char * name) { m_lock = 0; m_name = name;}
+  thr_spin_lock(const char * name)
+  {
+    m_lock = 0;
+    m_name = name;
+    m_contended_count = 0;
+  }
 
   const char * m_name;
+  Uint32 m_contended_count;
   volatile unsigned m_lock;
 };
 
@@ -179,7 +185,14 @@ test:
   if (likely(xcng(val, 1) == 0))
     return;
 
-  printf("%s waiting for lock\n", sl->m_name);
+  /*
+   * There is a race conditions here on m_contended_count. But it doesn't
+   * really matter if the counts are not 100% accurate
+   */
+  Uint32 count = sl->m_contended_count++;
+  Uint32 freq = (count > 10000 ? 5000 : (count > 20 ? 200 : 1));
+  if ((count % freq) == 0)
+    printf("%s waiting for lock, contentions~=%u\n", sl->m_name, count);
 
   do {
     cpu_pause();
@@ -1074,6 +1087,7 @@ mt_thr_main(void *thr_arg)
     the numeric thread id in this slightly backwards way.
   */
   unsigned thr_no = selfptr - &(rep->m_thread[0]);
+#ifdef NDB_MT_LOCK_TO_CPU
   pid_t tid = (unsigned)syscall(SYS_gettid);
   ndbout_c("Tread %u started, tid=%u", thr_no, tid);
   ndbout_c("lock to cpu %u", (thr_no & 1));
@@ -1083,6 +1097,7 @@ mt_thr_main(void *thr_arg)
     CPU_SET(((thr_no & 1)*2 + 1), &mask);
     sched_setaffinity(tid, sizeof(mask), &mask);
   }
+#endif
 
   /*
     Now we need to somehow assign to this thread all blocks that will run in
Thread
bk commit into 5.1 tree (knielsen:1.2617)knielsen12 Oct