Skip to content

Commit 0fab786

Browse files
committed
lock readout memory to RAM
1 parent 8777904 commit 0fab786

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/mainReadout.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <boost/property_tree/ptree.hpp>
2424
#include <thread>
2525
#include <time.h>
26+
#include <sys/mman.h>
2627

2728
#include "DataBlock.h"
2829
#include "DataBlockContainer.h"
@@ -1235,6 +1236,11 @@ class ReadoutOCCStateMachine : public RuntimeControlledObject
12351236
// the main program loop
12361237
int main(int argc, char* argv[])
12371238
{
1239+
// before anything, ensure all memory used by readout is kept in RAM
1240+
bool memLockSuccess = false;
1241+
if (mlockall(MCL_CURRENT | MCL_FUTURE) == 0) {
1242+
memLockSuccess = true;
1243+
}
12381244

12391245
// check environment settings
12401246

@@ -1265,6 +1271,11 @@ int main(int argc, char* argv[])
12651271
return err;
12661272
}
12671273

1274+
// report memlock status
1275+
if (!memLockSuccess) {
1276+
theLog.log(LogWarningSupport_(3230), "Failed to lock readout memory");
1277+
}
1278+
12681279
if (occMode) {
12691280
#ifdef WITH_OCC
12701281
theLog.log(LogInfoDevel, "Readout entering OCC state machine");

0 commit comments

Comments
 (0)