Merged Murali's memlock_all branch.

This commit is contained in:
Andrew Johnson
2014-08-29 10:58:55 -07:00
2 changed files with 47 additions and 0 deletions

View File

@@ -15,6 +15,29 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.</p>
<h2 align="center">Changes between 3.15.0.1 and 3.15.0.2</h2>
<!-- Insert new items immediately below here ... -->
<h3>On POSIX, attempt to lock all memory when running with FIFO scheduler</h3>
<p>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.</p>
<p>On Linux, one can grant a process the ability to run threads with different
priorities by using the command <code>ulimit -r unlimited</code>. To use the FIFO
scheduler for an IOC, use a command like this:</p>
<blockquote><pre>chrt -f 1 softIoc -d test.db</pre></blockquote>
<p>On Linux, one can grant a process the ability to lock memory using the command
<code>ulimit -l unlimited</code>. These limits can also be configured on a per
user/per group basis by changing /etc/security/limits.conf or its equivalent.</p>
<p>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.</p>
<h3>Implement EPICS_CAS_INTF_ADDR_LIST in rsrv</h3>
<p>The IOC server can now bind to a single IP address (and optional port number)

View File

@@ -35,6 +35,13 @@
#include "epicsAssert.h"
#include "epicsExit.h"
#if defined(linux)
#if _POSIX_MEMLOCK > 0
#include <sys/mman.h>
#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 */