LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to prioritize the use of physical memory instead of swap? (https://www.linuxquestions.org/questions/slackware-14/how-to-prioritize-the-use-of-physical-memory-instead-of-swap-840219/)

afreitascs 10-24-2010 08:03 PM

How to prioritize the use of physical memory instead of swap?
 
Hi

I have a system with 2G of memory and swap memory of 4G.
This is the output from :


$cat /proc/meminfo

PHP Code:

$cat /proc/meminfo 
MemTotal
:        2046312 kB
MemFree
:          209800 kB
Buffers
:           60532 kB
Cached
:          1284560 kB
SwapCached
:            4 kB
Active
:           953280 kB
Inactive
:         754836 kB
Active
(anon):     226108 kB
Inactive
(anon):   138064 kB
Active
(file):     727172 kB
Inactive
(file):   616772 kB
Unevictable
:           0 kB
Mlocked
:               0 kB
SwapTotal
:       4256664 kB
SwapFree
:        4256660 kB
Dirty
:               112 kB
Writeback
:             0 kB
AnonPages
:        363032 kB
Mapped
:            85688 kB
Shmem
:              1148 kB
Slab
:              62920 kB
SReclaimable
:      47532 kB
SUnreclaim
:        15388 kB
KernelStack
:        2440 kB
PageTables
:        24484 kB
NFS_Unstable
:          0 kB
Bounce
:                0 kB
WritebackTmp
:          0 kB
CommitLimit
:     5279820 kB
Committed_AS
:    1825604 kB
VmallocTotal
:   34359738367 kB
VmallocUsed
:      308512 kB
VmallocChunk
:   34359403404 kB
DirectMap4k
:      225152 kB
DirectMap2M
:     1869824 kB 

How could they do to the memory cache to be used as much? Because, occasionally,
swap is used and note that the system could use the memory cache does not swap ...


Thanks

ps: Slackware current 64 multilib

maxmiorim 10-24-2010 08:23 PM

You may want to tune /proc/sys/vm/swappiness, see http://kerneltrap.org/node/3000.

Also, linux-mm.org (more specfically, http://linux-mm.org/LinuxMMDocumentation and http://linux-mm.org/LinuxMMInternals) helps to understand how the whole memory management thing works. ;)

syg00 10-24-2010 08:44 PM

Precisely 1 page of swap is in use. That single page is (swap)cached - meaning it will be read from memory, not read in from disk should it ever be referenced again. That single page was probably swapped out because it hadn't been referenced in ages.
How much more efficient can it get ?.

afreitascs 10-24-2010 09:30 PM

maxmiorim

È estranho para mim mesmo dizer obrigado a um compatriota (em ingles) ,de toda forma ai vai ...

Muito obrigado pelo links,tentarei entender o que esta escrito em ingles( meu ingles é muito ruim ) e o seu conteudo ,de toda forma,
pelo pouco que li ,me parece muito interessante ....

ps:Eu sei que a linguagem no forum é o ingles ,não fique aborrecido comigo mesmo :-)

Quote:

translation

It is strange to me even to say thanks to a fellow (in English), anyway here it goes ...

Thank you for the links, try to understand what is written in english (my english is very bad) and its contents, anyway,
the little I've read, it seems very interesting ....

ps:I know the language the forum is english, do not get upset with myself
||-------------------------------------||

syg00

Haaa ... I think I understood then ....

thanks

stitchman 10-25-2010 03:52 PM

This might or might not help you, but if you are like me and see that swap is used and you have memory free, use the swapoff command.

You can then swapon /dev/<swap partition> to get a cleared out swap space.

Or if you are feeling very adventurous, get some more memory and run without any swap! :)

afreitascs 10-25-2010 10:04 PM

Quote:

Originally Posted by stitchman (Post 4139034)
This might or might not help you, but if you are like me and see that swap is used and you have memory free, use the swapoff command.

You can then swapon /dev/<swap partition> to get a cleared out swap space.

Or if you are feeling very adventurous, get some more memory and run without any swap! :)

That's what I normally do, thanks. :-)

Anyway, if I translate correctly so that I can even understand the explanation of syg00,
satisfy me ...

many thanks

ps:I think it is hard to find is the simplicity ...

rmjohnso 10-26-2010 04:20 PM

Quote:

Originally Posted by stitchman (Post 4139034)
This might or might not help you, but if you are like me and see that swap is used and you have memory free, use the swapoff command.

You can then swapon /dev/<swap partition> to get a cleared out swap space.

Or if you are feeling very adventurous, get some more memory and run without any swap! :)

I've not run with swap in years. Once I got to 2GB of RAM, I found I never was using swap on my laptop, so I just stopped making a swap file and / or swap partition. I've got 4 GB now, and I have yet to encounter any issues.


All times are GMT -5. The time now is 05:33 PM.