diff options
author | unknown <jonas@perch.ndb.mysql.com> | 2007-01-17 21:15:13 +0100 |
---|---|---|
committer | unknown <jonas@perch.ndb.mysql.com> | 2007-01-17 21:15:13 +0100 |
commit | fed5cb6ac84d1d4eda0e2286f2efecba103eb8c3 (patch) | |
tree | 871565c13f511d6cfbaa8bea8d4292cebf3f7cad /ndb | |
parent | 45b1bdb1b237dde4710501e737b6d4509665a879 (diff) | |
download | mariadb-git-fed5cb6ac84d1d4eda0e2286f2efecba103eb8c3.tar.gz |
ndb - bug#25686
add support for doing mlockall before mallc instead of after
(recommit in 5.0)
ndb/include/portlib/NdbMem.h:
add support for doing mlockall before mallc instead of after
ndb/src/common/portlib/NdbMem.c:
add support for doing mlockall before mallc instead of after
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
add support for doing mlockall before mallc instead of after
ndb/src/kernel/vm/Configuration.cpp:
add support for doing mlockall before mallc instead of after
ndb/src/kernel/vm/Configuration.hpp:
add support for doing mlockall before mallc instead of after
ndb/src/mgmsrv/ConfigInfo.cpp:
add support for doing mlockall before mallc instead of after
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/include/portlib/NdbMem.h | 2 | ||||
-rw-r--r-- | ndb/src/common/portlib/NdbMem.c | 10 | ||||
-rw-r--r-- | ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp | 19 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Configuration.cpp | 2 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Configuration.hpp | 2 | ||||
-rw-r--r-- | ndb/src/mgmsrv/ConfigInfo.cpp | 8 |
6 files changed, 33 insertions, 10 deletions
diff --git a/ndb/include/portlib/NdbMem.h b/ndb/include/portlib/NdbMem.h index 0f2de80200e..2afb1845112 100644 --- a/ndb/include/portlib/NdbMem.h +++ b/ndb/include/portlib/NdbMem.h @@ -66,7 +66,7 @@ void NdbMem_Free(void* ptr); * NdbMem_MemLockAll * Locks virtual memory in main memory */ -int NdbMem_MemLockAll(void); +int NdbMem_MemLockAll(int); /** * NdbMem_MemUnlockAll diff --git a/ndb/src/common/portlib/NdbMem.c b/ndb/src/common/portlib/NdbMem.c index f964f4d9937..0d2021aaf0a 100644 --- a/ndb/src/common/portlib/NdbMem.c +++ b/ndb/src/common/portlib/NdbMem.c @@ -57,7 +57,15 @@ void NdbMem_Free(void* ptr) } -int NdbMem_MemLockAll(){ +int NdbMem_MemLockAll(int i){ + if (i == 1) + { +#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined (MCL_FUTURE) + return mlockall(MCL_CURRENT | MCL_FUTURE); +#else + return -1; +#endif + } #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) return mlockall(MCL_CURRENT); #else diff --git a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp index cd0e471a676..5642a11db81 100644 --- a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp +++ b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp @@ -342,9 +342,9 @@ void Cmvmi::execSTTOR(Signal* signal) if (theStartPhase == 1){ jam(); - if(theConfig.lockPagesInMainMemory()) + if(theConfig.lockPagesInMainMemory() == 1) { - int res = NdbMem_MemLockAll(); + int res = NdbMem_MemLockAll(0); if(res != 0){ g_eventLogger.warning("Failed to memlock pages"); warningEvent("Failed to memlock pages"); @@ -788,6 +788,21 @@ Cmvmi::execSTART_ORD(Signal* signal) { if(globalData.theStartLevel == NodeState::SL_CMVMI){ jam(); + + if(theConfig.lockPagesInMainMemory() == 2) + { + int res = NdbMem_MemLockAll(1); + if(res != 0) + { + g_eventLogger.warning("Failed to memlock pages"); + warningEvent("Failed to memlock pages"); + } + else + { + g_eventLogger.info("Locked future allocations"); + } + } + globalData.theStartLevel = NodeState::SL_STARTING; globalData.theRestartFlag = system_started; /** diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index 49f16dae3dd..cbdd9494fd8 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -477,7 +477,7 @@ Configuration::setupConfiguration(){ DBUG_VOID_RETURN; } -bool +Uint32 Configuration::lockPagesInMainMemory() const { return _lockPagesInMainMemory; } diff --git a/ndb/src/kernel/vm/Configuration.hpp b/ndb/src/kernel/vm/Configuration.hpp index 6315209ddbb..13b31ad3538 100644 --- a/ndb/src/kernel/vm/Configuration.hpp +++ b/ndb/src/kernel/vm/Configuration.hpp @@ -37,7 +37,7 @@ public: void setupConfiguration(); void closeConfiguration(bool end_session= true); - bool lockPagesInMainMemory() const; + Uint32 lockPagesInMainMemory() const; int timeBetweenWatchDogCheck() const ; void timeBetweenWatchDogCheck(int value); diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp index ab4f2b413b3..7f89f5c5c49 100644 --- a/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/ndb/src/mgmsrv/ConfigInfo.cpp @@ -564,10 +564,10 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "If set to yes, then NDB Cluster data will not be swapped out to disk", ConfigInfo::CI_USED, true, - ConfigInfo::CI_BOOL, - "false", - "false", - "true" }, + ConfigInfo::CI_INT, + "0", + "1", + "2" }, { CFG_DB_WATCHDOG_INTERVAL, |