List:Commits« Previous MessageNext Message »
From:mikael Date:March 8 2007 6:47pm
Subject:bk commit into 5.1 tree (mikron:1.2439)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mikron. When mikron 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-03-08 19:47:28+01:00, mikron@stripped +5 -0
  Remove printouts from setRealtimeScheduler and call this regularly
  to get out of real-time priority momentarily to give the OS a chance to do
  important things. Is required at very high loads to avoid that the
  OS crashes.

  storage/ndb/src/kernel/main.cpp@stripped, 2007-03-08 19:45:38+01:00, mikron@stripped +1 -1
    Get thread index of main thread to ipControlLoop

  storage/ndb/src/kernel/vm/Configuration.cpp@stripped, 2007-03-08 19:45:39+01:00, mikron@stripped +22 -7
    Remove printouts from setRealtimeScheduler and call this regularly
    to get out of real-time priority momentarily to give the OS a chance to do
    important things. Is required at very high loads to avoid that the
    OS crashes.

  storage/ndb/src/kernel/vm/Configuration.hpp@stripped, 2007-03-08 19:45:39+01:00, mikron@stripped +2 -0
    Remove printouts from setRealtimeScheduler and call this regularly
    to get out of real-time priority momentarily to give the OS a chance to do
    important things. Is required at very high loads to avoid that the
    OS crashes.

  storage/ndb/src/kernel/vm/ThreadConfig.cpp@stripped, 2007-03-08 19:45:39+01:00, mikron@stripped +7 -1
    Remove printouts from setRealtimeScheduler and call this regularly
    to get out of real-time priority momentarily to give the OS a chance to do
    important things. Is required at very high loads to avoid that the
    OS crashes.

  storage/ndb/src/kernel/vm/ThreadConfig.hpp@stripped, 2007-03-08 19:45:39+01:00, mikron@stripped +1 -1
    Remove printouts from setRealtimeScheduler and call this regularly
    to get out of real-time priority momentarily to give the OS a chance to do
    important things. Is required at very high loads to avoid that the
    OS crashes.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mikron
# Host:	21.37.251.10.in-addr.arpa
# Root:	/Users/mikron/mysql_clones/latest-rt-patch

--- 1.64/storage/ndb/src/kernel/main.cpp	2007-02-20 15:37:13 +01:00
+++ 1.65/storage/ndb/src/kernel/main.cpp	2007-03-08 19:45:38 +01:00
@@ -468,7 +468,7 @@
   //  theConfig->closeConfiguration();
   {
     Uint32 inx = globalEmulatorData.theConfiguration->addThreadId(MainThread);
-    globalEmulatorData.theThreadConfig->ipControlLoop();
+    globalEmulatorData.theThreadConfig->ipControlLoop(inx);
     globalEmulatorData.theConfiguration->removeThreadId(inx);
   }
   NdbShutdown(NST_Normal);

--- 1.58/storage/ndb/src/kernel/vm/Configuration.cpp	2007-03-02 19:14:25 +01:00
+++ 1.59/storage/ndb/src/kernel/vm/Configuration.cpp	2007-03-08 19:45:39 +01:00
@@ -1004,6 +1004,7 @@
     {
       if (setRealtimeScheduler(threadInfo[i].threadHandle,
                                threadInfo[i].type,
+                               _realtimeScheduler,
                                FALSE))
         return;
     }
@@ -1030,6 +1031,7 @@
 int
 Configuration::setRealtimeScheduler(NDB_THAND_TYPE threadHandle,
                                     enum ThreadTypes type,
+                                    bool real_time
                                     bool init)
 {
   /*
@@ -1038,16 +1040,13 @@
   */
   if (!threadHandle)
     return 0; 
-  if (!init || _realtimeScheduler)
+  if (!init || real_time)
   {
     int error_no;
-    ndbout << "Set scheduler " << _realtimeScheduler;
-    ndbout << " threadHandle = " << (int)threadHandle << endl;
-    if ((error_no = Ndb_SetScheduler(threadHandle, _realtimeScheduler,
+    if ((error_no = Ndb_SetScheduler(threadHandle, real_time,
                                     (type != MainThread))))
     {
-      ndbout << "Set scheduler failed with error_no = " << error_no << endl;
-      ;//Warning, no permission to set scheduler
+      //Warning, no permission to set scheduler
       return 1;
     }
   }
@@ -1146,7 +1145,7 @@
   threadInfo[i].threadId = threadId;
   threadInfo[i].type = type;
   NdbMutex_Unlock(threadIdMutex);
-  setRealtimeScheduler(threadHandle, type, TRUE);
+  setRealtimeScheduler(threadHandle, type, _realtimeScheduler, TRUE);
   setLockCPU(threadId, type, (type == MainThread), TRUE);
   return i;
 }
@@ -1159,6 +1158,22 @@
   threadInfo[index].threadHandle = 0;
   threadInfo[index].type = NotInUse;
   NdbMutex_Unlock(threadIdMutex);
+}
+
+void
+Configuration::yield_main(Uint32 index)
+{
+  if (_realtimeScheduler)
+  {
+    setRealtimeScheduler(threadInfo[index].threadHandle,
+                         threadInfo[index].type,
+                         FALSE,
+                         FALSE);
+    setRealtimeScheduler(threadInfo[index].threadHandle,
+                         threadInfo[index].type,
+                         TRUE,
+                         FALSE);
+  }
 }
 
 void

--- 1.24/storage/ndb/src/kernel/vm/Configuration.hpp	2007-03-02 19:14:25 +01:00
+++ 1.25/storage/ndb/src/kernel/vm/Configuration.hpp	2007-03-08 19:45:39 +01:00
@@ -92,9 +92,11 @@
                  bool init);
   int setRealtimeScheduler(NDB_THAND_TYPE threadHandle,
                            enum ThreadTypes type,
+                           bool real_time,
                            bool init);
   Uint32 addThreadId(enum ThreadTypes type);
   void removeThreadId(Uint32 index);
+  void yield_main(Uint32 thread_index);
   void initThreadArray();
 
   int timeBetweenWatchDogCheck() const ;

--- 1.8/storage/ndb/src/kernel/vm/ThreadConfig.cpp	2007-03-06 20:20:22 +01:00
+++ 1.9/storage/ndb/src/kernel/vm/ThreadConfig.cpp	2007-03-08 19:45:39 +01:00
@@ -97,7 +97,7 @@
 // The timeout value in this call is calculated as (10 ms - laptime)
 // This would make ndb use less cpu while improving response time.
 //--------------------------------------------------------------------
-void ThreadConfig::ipControlLoop()
+void ThreadConfig::ipControlLoop(Uint32 thread_index)
 {
   Uint32 execute_loop_constant =
         globalEmulatorData.theConfiguration->schedulerExecutionTimer();
@@ -114,6 +114,7 @@
   int res1 = 0;
   int res2 = 0;
   Uint32 i = 0;
+  Uint32 yield_count = 0;
 
 //--------------------------------------------------------------------
 // initialise the counter that keeps track of the current millisecond
@@ -141,6 +142,11 @@
         globalEmulatorData.theConfiguration->schedulerExecutionTimer();
       min_spin_time = 
         globalEmulatorData.theConfiguration->schedulerSpinTimer();
+      if (++yield_count >= 5)
+      {
+        globalEmulatorData.theConfiguration->yield_main(thread_index);
+        yield_count = 0;
+      }
       globalTransporterRegistry.update_connections();
       globalData.incrementWatchDogCounter(5);
       i = 0;

--- 1.3/storage/ndb/src/kernel/vm/ThreadConfig.hpp	2006-12-23 20:20:20 +01:00
+++ 1.4/storage/ndb/src/kernel/vm/ThreadConfig.hpp	2007-03-08 19:45:39 +01:00
@@ -28,7 +28,7 @@
   ThreadConfig();
   ~ThreadConfig();
 
-  void ipControlLoop();
+  void ipControlLoop(Uint32 thread_index);
 
   int doStart(NodeState::StartLevel startLevel);
 private:
Thread
bk commit into 5.1 tree (mikron:1.2439)mikael8 Mar