File bug-495258_ulimit_cmo_fix.patch of Package ulimit
get_mem in /etc/initscript calculates the total memory by adding
MemTotal and SwapTotal from /proc/meminfo. When running Active
Memory Sharing on Power systems, this value may be too small.
Memory that gets loaned out to other partitions gets deducted
from MemTotal. For example, on a partition with 4G of memory
allocated to it, if 3G is loaned out to other partitions, MemTotal
will only indicate 1G, resulting in ulimit getting set artificially
low. This results in memory allocation failures for applications.
Fix this by taking into account the amount of loaned memory when
running Active Memory Sharing.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
initscript | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff -puN initscript~ulimit_cmo_fix initscript
--- ulimit/initscript~ulimit_cmo_fix 2009-04-21 09:37:44.000000000 -0500
+++ ulimit-bjking1/initscript 2009-04-21 09:53:56.000000000 -0500
@@ -39,7 +39,11 @@ calc_limit()
get_mem()
{
- TOT=0
+ TOT=0; LOANEDTOT=0
+ # Get loaned memory if running CMO
+ if test -r /sys/devices/system/cmm/cmm0/loaned_kb; then
+ LOANEDTOT=`cat /sys/devices/system/cmm/cmm0/loaned_kb`
+ fi
if test -r /proc/meminfo; then
# Get memory & swap sizes to evaluate the percentages
MEMTOT=0; SWPTOT=0
@@ -53,7 +57,7 @@ get_mem()
;;
esac
done < /proc/meminfo
- TOT=$(($MEMTOT+$SWPTOT))
+ TOT=$(($MEMTOT+$SWPTOT+$LOANEDTOT))
fi
}
_