0

When should the usage of swap get started? or

How do I know that my swap is being used? At least some times if not always, considering the default swappiness of 60

Also, why does free offer to omit the buffers/cache line, shouldn't it be considered? I've always referred just free -got's output.

My memory stats is as below, have never seen the swap being used, at all. Has the buffers/cache something to do in regards?

-bash-3.2$ free -mt
             total       used       free     shared    buffers     cached
Mem:         64458      24419      40039          0         38        212
-/+ buffers/cache:      24167      40290
Swap:        16386          0      16386
Total:       80845      24419      56425

The swappiness value is the default one.

cat /proc/sys/vm/swappiness
60

Need to know these as I've had the situations wherein all of my 62Gigs RAM was used.

Please enlighten.

1

how do I know that my swap is being used?

have never seen the swap being used, at all.

Try to create memory pressure in order to make Linux page-out pages. On my system swap was also 0. Then I run stress --vm 30. Here is a help on strees:

$ stress --help
`stress' imposes certain types of compute stress on your system

Usage: stress [OPTION [ARG]] ...
 ....
 -m, --vm N         spawn N workers spinning on malloc()/free()
     --vm-bytes B   malloc B bytes per vm worker (default is 256MB)
     --vm-stride B  touch a byte every B bytes (default is 4096)
     --vm-hang N    sleep N secs before free (default none, 0 is inf)
     --vm-keep      redirty memory instead of freeing and reallocating

30 instances of strees cause memory pressure and Linux started page-out pages, which was clear from vmstat 1. See for so column:

man vmstat:
   Swap
       si: Amount of memory swapped in from disk (/s).
       so: Amount of memory swapped to disk (/s).

vmstat report:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
98  0  0    
 0  0      0 3355728 112016 2052000    0    0     0     0  287  335  3  1 96  0  0  
30  0      0 358472 112016 2052000    0    0     0     0 1575 1012  7 74 19  0  0   
14 33 141588  99032  60252 1578948  268 141764   404 142080 6896 3249  3 93  0  4  0    
31 24 302632  98664  17208 1020240 8280 165008  8308 165236 5686 4114  5 76  0 20  0    
11 22 494516  98732   4208 615496 3112 191952 11552 192060 5494 5199  2 64  1 33  0 

And swap used became big enough:

             total   used       free     shared    buffers     cached
Mem:          7228   1411       5816          0         23        171
-/+ buffers/cache:   1217       6011
Swap:         4647        824       3823
Total:       11876   2236       9640

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.