Questions tagged [swap]

Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory(RAM) and the swap space is the amount of virtual memory available. Linux has two forms of swap space: the swap partition and the swap file.

From linux.com All about swap space:

Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.

Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache. However, swapping does have a downside. Compared to memory, disks are very slow.

Linux has two forms of swap space: the swap partition and the swap file. The swap partition is an independent section of the hard disk used solely for swapping; no other files can reside there. The swap file is a special file in the filesystem that resides amongst your system and data files.

Swap space size should be either similar to system RAM or double it's size.

340 questions
4
votes
2 answers

linux redhat + swapoff is stuck not return prompt

I do the following steps in order to increase the swap size but when I start with swapoff /dev/mapper/rootvg-swap , then its stuck for along time and not return the prompt why we can do to solve this swapoff /dev/mapper/rootvg-swap lvresize -L…
King David
  • 433
  • 4
  • 17
4
votes
1 answer

linux + adding swap space

I performed the following procedure in order to add 400m to swap, I took the 400m from the sdb disk for the swap increasing Everything was ok but before the last command , I performed mkswap /dev/rootvg/swap And I get the following warning…
King David
  • 433
  • 4
  • 17
4
votes
1 answer

Why does kswapd use 100% CPU with no swap space and plenty of cache available for reaping?

Firefox used a lot of memory and the machine ground to a near-halt with kswapd/kworker using most of the CPUs. There is no swap space, and vm.swappiness=0 on Linux 4.5.7 (Fedora 24). What I don't understand is that with nearly 1.5GB of buff/cache,…
4
votes
1 answer

Ubuntu Server 15.10, process not being allowed to use all physical memory, kswapd0 using 100% CPU

I have a 24-core server with 64G of DRAM, and it's running Ubuntu Server 15.10. I am getting some strange behavior with respect to swapping and physical memory use. I never had this trouble until I upgraded Ubuntu to 15.10. You can see my problem…
Timothy Miller
  • 291
  • 1
  • 2
  • 11
4
votes
3 answers

"Lack of free swap space" on Windows Server

I have several Windows Server 2012 Virtual Machines, which are monitored by zabbix 2.4. The zabbix throws "Lack of free swap space" for some VMs, but there are disk and memory free on these machines, and the Virtual Memory is set to OS Control on…
Elieser Topassi
  • 103
  • 1
  • 1
  • 10
4
votes
1 answer

ATOP: vmcom / vmlim -> SWP is red

in ATOP I'm getting a red alert like this: vmcom 76.3G | vmlim 49.8G This is a value that is attached to the "SWP" (so "SWAP" is meant?)-line. What does this mean and what can I do against it?
MyFault
  • 893
  • 3
  • 14
  • 35
4
votes
3 answers

How can I keep important VMs in memory without disabling swap?

VM Host -> Xenon E5-2440 w/ 48G mem... Everything runs CentOS6.5 (2.6.32-431) I have 4 guest VMs running each w/ 2G of memory. Their disk images are local files. The host machine is also running a lightly used NFS server but not much else.…
4
votes
1 answer

Is it sensible to use SLC swap as a RAM substitute on a VM host?

I have a few oldish servers running virtual machines but they are limited to 16GB RAM and that limits the number of VMs I can run and the options for RDS. I've added a RAID1 array of two Intel 311s: 20GB SLC SSDs, and configured them as swap on the…
user83664
4
votes
2 answers

How to read `top`. Process list says processes have swap but overview says no swap is being used

I am using top to monitor my server. The swap row reads Swap: 1044220k total, 0k used, 1044220k free, 148544k cached I have hit O p to sort by swap. PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP COMMAND 703 mysql…
dm03514
  • 191
  • 1
  • 3
  • 12
4
votes
2 answers

Linux cached memory: Over 85% of cached memory and using swap

I read about Linux and cachd memory at linuxatemyram but there is something that doesn't make sense to me, if the server have even a low load, instead of freeing some cached memory it starts using swap, which makes the server slow.. Even now, when…
Kuf
  • 449
  • 2
  • 8
  • 24
4
votes
1 answer

How to lock a process in RAM (make it unswapable)

Is there a way to instruct the kernel (Linux kernel) to never swap a certain process that has already been started?
Krastanov
  • 143
  • 4
4
votes
1 answer

Apache is not using SWAP and it's reporting page allocation failure

Check the logs: httpd: page allocation failure. order:4, mode:0xd0 Call Trace: [] __alloc_pages+0x2ef/0x308 [] cache_grow+0x139/0x3c7 [] cache_alloc_refill+0x138/0x188 []…
Spacedust
  • 558
  • 5
  • 12
  • 28
4
votes
1 answer

Server refuses to use swap partition

We are running a server with 23 cores (cpuinfo shows 22 as the highest process number) and 66 Gig RAM. The development team here is running some apps, which hogs memory. I have observered that: 1. Even when the memory runs very low (free memory =…
4
votes
3 answers

Identifying a process that leaks memory

On a linux server (Ubuntu Lucid), my used swap keeps growing by the hour on a server, and I'm having a hard time identifying which process is growing in swap. What tool can I use to monitor this?
raphink
  • 11,337
  • 6
  • 36
  • 47
4
votes
3 answers

Do I need SWAP on my server?

I have a particular server : 50GB SSD for the OS (CentOS) , 128GB of RAM and 320GB SSD for MySQL. I'm wondering if I really need SWAP? I often read that 2GB is good even with lots of RAM. This server will be a MySQL database mainly. Is there any…
Bastien974
  • 1,824
  • 12
  • 43
  • 61