diff options
author | Fengguang Wu <fengguang.wu@intel.com> | 2012-11-27 20:21:57 +0800 |
---|---|---|
committer | Fengguang Wu <fengguang.wu@intel.com> | 2012-11-27 20:29:27 +0800 |
commit | 034ee1aa9058d4167d846f0d44b405ab841f3e04 (patch) | |
tree | 1b9c0edd6fb53bce25ee9e4ed78df686156642d6 | |
parent | 483554ef7c3f815035de189079400ef254d9d0b6 (diff) | |
download | vm-scalability-034ee1aa9058d4167d846f0d44b405ab841f3e04.tar.gz |
Abhinav's work on case-shm-lock-unlock
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
-rw-r--r-- | case-shm-lock-unlock | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/case-shm-lock-unlock b/case-shm-lock-unlock new file mode 100644 index 0000000..69c7f79 --- /dev/null +++ b/case-shm-lock-unlock @@ -0,0 +1,29 @@ +#!/bin/bash + +# +# Exercises the SYS V IPC code of mm/ +# +# Creates a shared segment using shmget, attaches and locks it +# +# to calling process's VM and then unlocks and releases it. +# + +source ./hw_vars + +#segment size being requested +SHM_SIZE=$(((mem / nr_cpu) / 10)) + +#check for max shared memory allowed on system +MAX_SHARE_SEGMENT=$(</proc/sys/kernel/shmmax) + +echo "MAX SEGMENT is $MAX_SHARE_SEGMENT total asking is $((mem / 10))" + +#check to see if the request can be satisfied else exit with error +if [ $MAX_SHARE_SEGMENT -lt $SHM_SIZE ] +then + echo "Cannot allocate more shared memory segment than $MAX_SHARE_SEGMENT" + echo "exiting now..." + exit 1 #exit on failure +fi + +$USEMEM -n $nr_cpu -L --random $SHM_SIZE |