Re: a swap partition utilization question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bill J.Xu wrote:

> > > After booting my linux box,I add a swap partition using "swapon
> > > /dev/hda5".but I found that swap partition was nerver used even
> > > 2M physics memory left.
> > > 
> > > why?
> > 
> >  Perhaps swap memory will not be used until
> > all physical memory has been consumed.
> 
> But I found that other linux box had used swap partition when many
> physical RAM left.
> 
> root@FW_knl:/home/shiy# free
>              total       used       free     shared    buffers     cached
> Mem:        255320     247564       7756          0      15652     197560
> -/+ buffers/cache:      34352     220968
> Swap:       996020       1484     994536
> root@FW_knl:/home/shiy# 

How long has the first box been up? And how intensive is memory demand
on that box?

Swap won't be used at all until physical memory becomes close to being
exhausted. However, after that point, even if more memory becomes
available, data won't be moved back into RAM unless it is actually
used.

There is often some data which will never be used again (e.g. memory
which is used by persistent daemons, but only during the
initialisation; the 6 getty processes running on tty1-tty6 which
typically never get used on a system which is running X, etc). Such
data is a strong candidate for being swapped out; once that happens,
it will typically never be swapped in again.

So, when a system is booted, there will always be a period when no
swap is used. If memory demand is low, that period may last
indefinitely. OTOH, once memory demand has been sufficiently high to
have required the use of swap, swap usage will probably never drop
back to zero.

-- 
Glynn Clements <glynn.clements@xxxxxxxxxx>
-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux