In the below 2.6.18 Linux Kernel (Red Hat) server, there is a lot of free memory, but I see some swap is used.  I always thought of swap as an overflow when memory has been depleted.  Why would it swap with about 7GB (50%) free memory?  Swappiness is 60 (default).Meminfo output:MemTotal:     16436132 kBMemFree:       7507008 kBBuffers:        534804 kBCached:        2642652 kBSwapCached:      39084 kBActive:        6001828 kBInactive:      2532028 kBHighTotal:           0 kBHighFree:            0 kBLowTotal:     16436132 kBLowFree:       7507008 kBSwapTotal:     2097144 kBSwapFree:      1990096 kBDirty:             236 kBWriteback:           0 kBAnonPages:     5353644 kBMapped:          45764 kBSlab:           330660 kBPageTables:      34020 kBNFS_Unstable:        0 kBBounce:              0 kBCommitLimit:  10315208 kBCommitted_AS: 14836360 kBVmallocTotal: 34359738367 kBVmallocUsed:    264660 kBVmallocChunk: 34359472735 kBHugePages_Total:     0HugePages_Free:      0HugePages_Rsvd:      0Hugepagesize:     2048 kB
Why is swap used when a lot of memory is still free?
linux;kernel;memory;swap
Swapping only when there is no free memory is only the case if you set swappiness to 0. Otherwise, during idle time, the kernel will swap memory. In doing this the data is not removed from memory, but rather a copy is made in the swap partition.This means that, should the situation arise that memory is depleted, it does not have to write to disk then and there. In this case the kernel can just overwrite the memory pages which have already been swapped, for which it knows that it has a copy of the data.The swappiness parameter basically just controls how much it does this.