From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96467645728397.tru64-unix-managers.marc@archive.invalid> From: sajan s Date: Thu, 27 Jul 2000 05:40:42 +0000 To: tru64-unix-managers Subject: SUMMARY: swapon -s output confusing - (pretty long) X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96467645728397 Thanks very much to: alan@ nabeth.cxo.dec.com,Jason Boyles,Calvin Coghlan, Dr. Tom Blin,Jnohn James,PABLO CESAR SALAZAR ALEMAN, Dave Simmonds Thanks for the detailed mail of the concepts, Mr.Alan. Dr, Tom Blin pointed out correctly. The systems phy memory was recently increased. (Now it has 188 MB swap whereas phy mem is 320!!!) I will add the mails of alan and Dr. Tom Blin which touches upon the theory. Original Posting: > Hi admins, > > In one of my DEC 433au - DU 4.0F (no patch)m/c user is running some > program that takes 95% of CPU. > > I am getting following output for swapon -s: > > Swap partition /dev/rz16b (default swap): > Allocated space: 24139 pages (188MB) > In-use space: 182 pages ( 0%) > Free space: 23957 pages ( 99%) > > > Total swap allocation: > Allocated space: 24139 pages (188MB) > Reserved space: 15103 pages ( 92%) > In-use space: 182 pages ( 0%) > Available space: 9036 pages ( 7%) > > vmstat shows pretty comfortable free mem > > vmstat 1 > Virtual Memory Statistics: (pagesize = 8192) > procs memory pages intr cpu > > r w u act free wire fault cow zero react pin pout in sy cs us sy id > 4 82 24 15K 17K 6292 1M 285K 434K 5122 281K 159 15 311 138 93 1 7 > > I am getting swap less than 10% free. But why it happens when free mem > pages is around 17k. > > Is there anything wrong with the system or is ithat my understanding > problem? > > Is it possible to know how swap is used up by individual users alan@ nabeth.cxo.dec.com ------------------------ The amount of virtual memory a process claims that it needs isn't necessarily related to the actual physical memory it needs at a given time. This is the advantage of "demand paged virtual memory". In the default page/swap space reservation mode, space is described by one of two states; reserved and allocated. While "allocated" is commonly used for both states, it is best to view space in the two states. When the space is initially created, the kernel reserves space, much as you would reserve a hotel room (at a hotel unlikely to overboot as airlines do). This reservation is reflected in the "Reserved space" line of the total. The reservation ensures that any process which needs page/swap space will have some. The actual choice of physical blocks is put off until the space is actually needed. At this point, the physical space is allocated. This shows up in the "In-use space" line of the total and the per-partition lines. So, in your case, some process (perhaps the 95% one or perhaps not) has allocated lots of virtual memory, but isn't using so much of it use a significant amount of physical memory. Or, it could be that among all the processes on the system, they're all using a respectable amount of virtual memory, which is causing the shortage of page/swap space. Small processes are as easily capable of using large amounts of CPU as large ones are. The ps(1) command with the appropriate options (see the manual page) will print the virtual memory size of each process. This listing should include the username for the process' UID. Or, you can use a long ls(1) listing of /proc. Each "file" in this file system is a process and the file size if the virtual memory size. The virtual memory size of a process isn't necessarily its page/swap usage. Programs can memory map files so that the mapped is used as the page/swap space for the memory instead of system page/swap space. And, I think shared library text and data space is counted completely for each process using such a library, but page/swap space is only needed for one copy. Still, this might give a clue where the space is going. For only 188 MB of page/swap space it could easily be that the space usage is fairly evenly distributed among all the processes on the system with none of them being particularly large. If you need additional page/swap space you can use the swapon command to add an unused disk partition to the available space. While it is possible to resize the system disk's page/swap partition to get more space, it means having to shrink one or more file system after it and that requires backing them, resizing and restoring. If you have the spare disk partition, you're better off using it directly. The system management guide should describe an option where you change the reservation mode so that space isn't reserved. This has the advantage of allowing the amount of virtual memory the system can be using to be the sum of available memory and page/swap space. In the default mode, the limit is simply the amount of page/swap space. HOWEVER! This mode doesn't ensure that processes will have page/swap space if they need it. What will happen if there is a shortfall of page/swap and something needs to page out, is that the kernel will find a process and kill it to get that space back. It prefers "idle" processes, but this can sometimes be something interesting. Don't use this mode unless you're willing to live with the consequences. Dr. Tom Blin ------------- The system is doing EXACTLY what it is supposed to be doing. In the output from swapon, you will notice that it shows 7% available. You probably have more real memory than swap space on this system; in any case, you are using "eager" allocation, so for EVERY page in memory, there needs to be a backing page available in swap (these typically show up as reserved pages in the swapon output). Either switch to "lazy" swap allocation, or allocate more swap. __________________________________________________ Do You Yahoo!? Get Yahoo! Mail - Free email you can access from anywhere! http://mail.yahoo.com/