1753789 會員
7710 線上
108799 解決方案
發表新文章

swapon -s ?

 
watermelonyu
教授

swapon -s ?

當我們下swapon -s可以看到系統swap的值

1.可以請問IN-use這個值,會縮回來嗎 ,還是只會不斷的增加

2.是可以反應現在這個時間的系統swap情況還是曾經 ?

#swapon -s

Swap partition /dev/disk/dsk2b (default swap):

Allocated space: 2758456 pages (21.05GB)

In-use space: 1223904 pages ( 44%)

Free space: 1534552 pages ( 55%)





Total swap allocation:

Allocated space: 2758456 pages (21.05GB)

Reserved space: 1396690 pages ( 50%)

In-use space: 1223904 pages ( 44%)

Available space: 1361766 pages ( 49%)

6則回覆 6
watermelonyu
教授

swapon -s ?

-s Displays swap space utilization. For each swap partition, this option displays the total amount of allocated swap space, the amount of swap space that is being used, and the amount of free swap space.



swapon -s 顯示的是系統目前使用的 swap 空間, 並不是歷史記錄

watermelonyu
教授

swapon -s ?

這個swap的空間在什麼時間會被回收呢 ?還是會佔住high water mark.就不會縮回來了呢.
watermelonyu
教授

swapon -s ?

when your process or application release the allocate swap space,
watermelonyu
教授

swapon -s ?



我們之前有將所有的process restart,但swap

的free space並沒有回收呢 ?



有否這樣的文件嗎,謝謝!
watermelonyu
教授

swapon -s ?

There are two strategies for swap space allocation: immediate mode and deferred or over-commitment mode. The two strategies differ in the point in time at which swap space is allocated. If immediate mode is used, swap

space is allocated when modifiable virtual address space is created. If deferred mode is used, swap space is not allocated until the system needs to write a modified virtual page to swap space. Immediate mode is the default swap space allocation strategy.



Immediate mode is more conservative than deferred mode because each modifiable virtual page is assigned a page of swap space when it is created. If you use the immediate mode of swap space allocation, you must allocate a swap space that is at least as large as the total amount of modifiable virtual address space that will be created on your system. Immediate mode

requires significantly more swap space than deferred mode because it guarantees that there will be enough swap space if every modifiable virtual page is modified.



If you use the deferred mode of swap space allocation, you must estimate the total amount of virtual address space that will be both created and modified, and compare that total amount with the size of your system's physical memory. If this total amount is greater than the size of physical memory, the swap space must be large enough to hold the modified virtual pages that do not fit into your physical memory. If your system's workload

is complex and you are unable to estimate the appropriate amount of swap

space by using this mode, you should first use the default amount of swap space and adjust the swap space as needed.



To determine which swap space allocation mode is being used, check the setting of the vm-swap-eager attribute in /etc/sysconfigtab. If this value is either not specified or set to 1, the system uses immediate swap mode. If it is set to 0 (zero), the system uses deferred mode.
watermelonyu
教授

swapon -s ?

vm_swap_eager

Specifies the swap allocation mode, which can be immediate mode (1) or deferred mode (0). Immediate mode is commonly referred to as "eager" mode and deferred mode is commonly referred to as "lazy" mode.



Default value: 1 (eager swap mode)



In eager swap mode, the kernel will block a memory allocation when it cannot reserve in advance a matching amount of swap space. Eager swap mode is recommended for systems with variable workloads, particularly for those with unpredictably high peaks of memory consumption. For eager swap mode, swap space should not be less than 111 percent of system memory. A swap space configuration of 150 percent of memory is

recommended for most systems, and small memory systems are likely to require swap space in excess of 150 percent of memory. In eager swap

mode, if swap space is not configured to exceed the amount of memory by a large enough percentage, the likelihood that system memory will be underutilized during times of peak demand is increased. In fact, configuring swap space that is less than the amount of memory on the system, even if swapping does not occur, prevents the kernel from using memory that represents the difference between memory and swap space amounts. When swap space is unavailable in eager swap mode, processes start blocking one another and, worst case, cause the system to hang.





In lazy swap mode, the kernel does not require a matching amount of swap space to be available in advance of a memory allocation. However, in lazy swap mode, the kernel kills processes to reclaim memory if an attempt to swap out a process fails because of nsufficient swap space. Because key kernel processes can be killed, this condition increases the likelihood of a system crash. Lazy swap mode is ppropriate on very large memory systems for which it is impractical to configure swap space that is half again as large as memory. Lazy swap mode is also appropriate for smaller systems with