A quick look through the script shows that $ram_locked is calculated
from "$pageslocked - $pp_kernel", which in turn effectively comes from
the output of "kstat -p | grep system_pages".
AFAIK, "locked" memory means pages of memory which are not pageable to
the swap device; i.e. they must remain in RAM at all times. Off the top
of my head, I believe any RT processes fall into this category (xnptd
being the most common cause for me), along with explicit requests via
interfaces such as mlockall(3c). I suspect ISM or DISM (as used heavily
by multi-process databases) probably locks pages in RAM, but it's been a
while since I looked into this.
[ "ipcs -a" can be used to display ISM segments and their creators ]
If I've grasped the right end of the right stick correctly, I don't
believe removing the swap device will have any effect. All this will do
is to force any paged out memory pages back into RAM. By definition,
they were paged out because the system ran short on RAM, looked for
pages which had not been used for a while, and moved them out of RAM
onto the swap device.
IMO, it's best to leave them there until the system decides it needs to
load them back in. Otherwise you just create a bunch of IO requests now
to read them back in, and after you re-add the swap device, the next
time the system is short of memory again, it has to spend more time
paging back out those things which you forced back into RAM earlier...
So, to the real question - what is the problem you are trying to
investigate and/or fix?
"The problem is I have several boxes with a lot of RAM Locked" - is this
really a problem? What issue is it causing you?
On my desktop system at the time of writing this, I have:
unix:0:system_pages:pageslocked 624224
unix:0:system_pages:pagestotal 1502540
This equates to ~2.38Gb locked out of a total of 5.73Gb. As a
percentage, it's 41.5% (higher that the 37.8% in your example), but as
far as I'm aware, it's not causing me a problem, so I don't need to do
anything about it. If my system was thrashing the swap device and
running slowly because it was running out of RAM and constantly paging
around the locked memory, then I might look at this. Until that point is
reached, it shouldn't need any investigation.
Regards,
Brian
On 08/09/2011 15:25, Jordi wrote:
Hi all,
I'm using this script to get the memory stats in some servers:
http://www.brendangregg.com/k9toolkit.html
It's pretty cool and works well. The problem is I have several boxes
with a lot of RAM Locked (Locked memory pages from swap). Ex:
$ /usr/local/scripts/admintools/swapinfo
RAM _____Total 49141.8 Mb
RAM Unusable 1290.1 Mb
RAM Kernel 3437.2 Mb
RAM Locked 18620.5 Mb
RAM Used 23747.2 Mb
RAM Avail 2046.8 Mb
Disk _____Total 32773.2 Mb
Disk Alloc 9387.4 Mb
Disk Free 23385.9 Mb
Swap _____Total 72248.7 Mb
Swap Alloc 51453.5 Mb
Swap Unalloc 1142.9 Mb
Swap Avail 19652.3 Mb
Swap (MinFree) 6141.7 Mb
As you can see in this machine I have almost 19GB locked (RAM Locked
18620.5 Mb). A lot of!
So, is clear I want to "clean up" this memory. I've read a bit:
http://blogs.oracle.com/jimlaurent/entry/solaris_faq_myths_and_facts
http://www.softpanorama.org/Solaris/Processes_and_memory/swap_space_management.shtml
My understanding is I can "free" this locked RAM by SWAP simply
shutting down the SWAP device and then activating it again:
$ swap -d /device
$ swap -a /device
But the problem is, by default, we're using the next vfstab:
$ cat /etc/vfstab
#device device mount FS fsck mount
mount
#to mount to fsck point type pass at
boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c0t0d0s1 - - swap - no -
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1
no -
/dev/dsk/c0t0d0s4 /dev/rdsk/c0t0d0s4 /var ufs 1
no -
/dev/dsk/c0t0d0s3 /dev/rdsk/c0t0d0s3 /home ufs 2
yes -
/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /opt ufs 2
yes -
/devices - /devices devfs - no -
sharefs - /etc/dfs/sharetab sharefs - no -
ctfs - /system/contract ctfs - no -
objfs - /system/object objfs - no -
swap - /tmp tmpfs - yes -
So I cannot simply turn off the SWAP.
Is it possible to free all this locked RAM in SWAP? How?
Anotheer question will be of is there some way to limit the amount of
"lockable" RAM memory from SWAP...
Thanks for all.
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org
--
Brian Ruthven
Solaris Network RPE (Sustaining)
Oracle UK
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org