From 1b7c161f7f70a813f31346052e8f5b6d88904a01 Mon Sep 17 00:00:00 2001
From: Murali Shankar
Date: Tue, 26 Aug 2014 17:29:27 -0700
Subject: [PATCH 1/2] On POSIX systems, an IOC application's ability to meet
timing deadlines is often dependent on its ability to lock part or all of
the process's virtual address space into RAM, preventing that memory from
being paged to the swap area. This patch will attempt to lock the process's
virtual address space into RAM if the process has the ability to run threads
with different priorities. If unsuccessful, it prints an message to stderr.
In Linux, one can grant a process the ability to run threads with different
priorities by using a command like ulimit -r unlimited. To use the FIFO
scheduler, use a command like so - chrt -f 1 softIoc -d test.db
In Linux, one can grant a process the ability to lock memory by using a command
like ulimit -l unlimited. Alternatively, these limits can be configured on a per
user/per group basis by using /etc/security/limits.conf or its equivalent.
In Linux, a child process created via fork inherits its parent's resource
limits. Thus, it is probably a good idea to start the caRepeater before
starting the IOC.
---
src/libCom/osi/os/posix/osdThread.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/libCom/osi/os/posix/osdThread.c b/src/libCom/osi/os/posix/osdThread.c
index 18cc0b67b..90e8de7c3 100644
--- a/src/libCom/osi/os/posix/osdThread.c
+++ b/src/libCom/osi/os/posix/osdThread.c
@@ -35,6 +35,13 @@
#include "epicsAssert.h"
#include "epicsExit.h"
+#if defined(linux)
+#if _POSIX_MEMLOCK > 0
+#include
+#endif
+#endif
+
+
epicsShareFunc void epicsThreadShowInfo(epicsThreadOSD *pthreadInfo, unsigned int level);
epicsShareFunc void osdThreadHooksRun(epicsThreadId id);
epicsShareFunc void osdThreadHooksRunMain(epicsThreadId id);
@@ -344,6 +351,23 @@ static void once(void)
fprintf(stderr,"sched_get_priority_min failed set to %d\n",
pcommonAttr->maxPriority);
}
+
+#if _POSIX_MEMLOCK > 0
+ if(errVerbose) {
+ fprintf(stderr, "LRT: min priority: %d max priority %d\n",
+ pcommonAttr->minPriority, pcommonAttr->maxPriority);
+ }
+ if (pcommonAttr->maxPriority > pcommonAttr->minPriority) {
+ status = mlockall(MCL_CURRENT | MCL_FUTURE);
+ if(status) {
+ fprintf(stderr, "Unable to lock the virtual address space using mlockall\n");
+ } else {
+ fprintf(stderr,"Successfully locked memory using mlockAll\n");
+ }
+ }
+#endif
+
+
#else
if(errVerbose) fprintf(stderr,"task priorities are not implemented\n");
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
From 67ed5d1f21e939467a9441bab00aa8aacfa1be47 Mon Sep 17 00:00:00 2001
From: Murali Shankar
Date: Wed, 27 Aug 2014 12:15:04 -0700
Subject: [PATCH 2/2] Added documentation for memlock_all to the release notes
---
documentation/RELEASE_NOTES.html | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html
index 3db8233c0..d70bb4c39 100644
--- a/documentation/RELEASE_NOTES.html
+++ b/documentation/RELEASE_NOTES.html
@@ -15,6 +15,29 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.
Changes between 3.15.0.1 and 3.15.0.2
+On POSIX systems, attempt to lock all memory on startup if running with a FIFO scheduler
+
+
+On POSIX systems, an IOC application's ability to meet timing deadlines is often
+dependent on its ability to lock part or all of the process's virtual
+address space into RAM, preventing that memory from being paged to the swap
+area. This change will attempt to lock the process's virtual address space into
+RAM if the process has the ability to run threads with different priorities. If
+unsuccessful, it prints an message to stderr and continues.
+
+In Linux, one can grant a process the ability to run threads with different
+priorities by using a command like ulimit -r unlimited. To use the FIFO
+scheduler, use a command like so - chrt -f 1 softIoc -d test.db
+
+In Linux, one can grant a process the ability to lock memory by using a command
+like ulimit -l unlimited. Alternatively, these limits can be configured on a per
+user/per group basis by changing /etc/security/limits.conf or its equivalent.
+
+In Linux, a child process created via fork inherits its parent's resource
+limits. Thus, it is probably a good idea to start the caRepeater before
+starting the IOC.
+
+
Implement EPICS_CAS_INTF_ADDR_LIST in rsrv
The IOC server can now bind to a single IP address (and optional port number)