From 3f11ce996ca7e2b61760bcf0703e398e942c06e5 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 24 Nov 2023 11:54:11 +0100 Subject: [PATCH] Add option to avoid mlock and do so automatically for systems with small memory --- iocsh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/iocsh b/iocsh index d374df2..1327672 100755 --- a/iocsh +++ b/iocsh @@ -10,7 +10,8 @@ help () { -v, --version Show version and exit. -win, --win Run Windows softIOC via wine. -32 Force 32 bit version (on 64 bit systems). - --nopva Do not use PVA (in EPICS 7) + --nopva Do not use PVA (in EPICS 7). + --nolock Do not lock memory into RAM (in EPICS 3.15.3+). -x[.z[.y]] Select EPICS base version x.z.y (e.g. 3.14.8, 3.15, 7). -d, --debug Run IOC with gdb. -dv Run IOC with valgrind. @@ -124,6 +125,9 @@ do ( -nopva | --nopva ) NOPVA=1 ;; + ( -nolock | --nolock ) + NOLOCK=1 + ;; ( -n | --name ) shift IOC="$1" @@ -239,9 +243,12 @@ case "$EPICS_HOST_ARCH" in EXEPOSTFIX=.exe ;; - # Some architectures have not enough memory to run PVA - ( moxa42-armv6l | eldk42-ppc4xxFP ) + # Some architectures have little memory + ( mvl40-xscale_be | moxa42-armv6l | eldk42-ppc4xxFP ) + # Safe memory by not using PVA NOPVA=1 + # Do not lock memory in RAM to save on VmRSS + NOLOCK=1 ;; esac @@ -483,6 +490,12 @@ else echo "${APP}_registerRecordDeviceDriver(pdbbase)" fi +# switch off memoy lock if requested (only for EPICS 3.15.3+) +if [ "$BASECODE" -ge 3150300 -a -n "$NOLOCK" ] +then + echo "var dbThreadRealtimeLock 0" +fi + # use WINE to run softIo, and convert EPICS_DRIVER_PATH to windows format if [[ "$EXEPOSTFIX" == ".exe" ]] then