You are not logged in.
Since I'm no longer using a swap partition...
I used to figure that mounting a ramdisk as swap was worse than useless. However, now that I know a bit more about paging, I'm wondering if having a dedicated ramdisk to act as a page cache would actually be helpful. Is the Linux kernel smart enough not to need this, or would it help make more efficient use of RAM?
Offline
How much RAM do you have? My machine has 8 G and I have *never* used a swap partition. Swap is an antiquated thing on modern hardware.
Last edited by graysky (2012-06-05 01:40:00)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
I don't see any point in dumping currently unneeded information loaded into RAM onto another part of the RAM so that other information can be loaded into RAM. That whole process seems redundant to me.
If you frequently find that you're filling up your RAM, and don't want to create a disk based swap file/partition, I suggest that you switch to lighter applications, and/or install more RAM in your PC.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
How much RAM do you have? My machine has 8 G and I have *never* used a swap partition. Swap is an antiquated thing on modern hardware.
Only on a desktop. In a large cluster environment with lots of users, 64G is nothing and swap fills pretty quickly.
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
I dunno, I almost never use it ... but it is there to allow a graceful degradation instead of a sudden disaster.
Never mind-- I missed the RAM disk part.
Last edited by ewaller (2012-06-06 03:26:49)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
I haven't used swap in quite a while either,
neither when i had 2GB of ram, nor now that i have plenty more.
The only thing that has ever "happened" in my usercase is Java->Minecraft getting smootly killed sometime when it leaked and ate RAM like a glutton.
This atleast makes me feel nice about linux managing and saving ones arse efficently
. Main: Intel Core i5 6600k @ 4.4 Ghz, 16 GB DDR4 XMP, Gefore GTX 970 (Gainward Phantom) - Arch Linux 64-Bit
. Server: Intel Core i5 2500k @ 3.9 Ghz, 8 GB DDR2-XMP RAM @ 1600 Mhz, Geforce GTX 570 (Gainward Phantom) - Arch Linux 64-Bit
. Body: Estrogen @ 90%, Testestorone @ 10% (Not scientific just out-of-my-guesstimate-brain)
Offline
I've got 16 gig of RAM and have stopped using swap as well.
The problem with swap on desktops with a lot or RAM is that it only really gets used when some process goes crazy because, databases and the like never try to use more RAM then they can so they don't run into swap either even though they can often potentially use as much RAM as you can throw at them.
This leads to the problem that when swap is used things crawl to a halt until the swap is full and the OOM killer shoots down a process (in newer kernels it really often finds that broken process and kills that first).
So you're just sitting there unable to do anything usefull until the culprit is killed.
Without swap on the other hand the OOM killer is started right away, kills the process gone crazy and you can work on. I find this extremely helpful especially when developing software that under normal circumstances takes roughly 8 gig ram where a small bug can easly make it grow indefinitely.. for example when fooling around with template meta programming you can easily make gcc take huge amounts of RAM (I've seen a program that computed primes with templates that could be compiled with less than 16 gig of RAM)
And Linux is really intelligent about using ram, it will have thrown away any filesystem caches long before the OOM killer gets started.
The only real problem is that swap is used for hibernate, I guess one could tune the swappiness of the system so it doesn't use it for anything else but I haven't bothered because I just don't use hibernate.
On servers things seem to be different even though I'm not sure I'd really use swap on a server that nobody but me has to trust..It's not like a server that's waiting on swap is any use..
However in theory it makes things more stable. Still I've never seen any of the servers I admin do anything usefull with swap, even though I've seen development servers that were really hard to get under control because they were swapping and so even ssh crawled to a halt (and the slowness of swap becomes even worse when you got > 24 GB of RAM and just as much swap)
Offline
Can you still hibernate your Laptop, when you don't have a Swap Partition the size of your RAM?
Offline
Can you still hibernate your Laptop, when you don't have a Swap Partition the size of your RAM?
It depends, the contents of your RAM are compressed before being written to swap, but it's pretty hard to predict the worst case compression ratio that can be obtained.
I hibernate my machine regularly with a swap space being only 49% of my total RAM available and I never have had problems, but my RAM usage is never 100% when I hibernate either, although it typically is above 49% used (without caches and buffers which are dropped on hibernation).
Last edited by Ramses de Norre (2012-06-19 08:20:22)
Offline
This leads to the problem that when swap is used things crawl to a halt until the swap is full and the OOM killer shoots down a process (in newer kernels it really often finds that broken process and kills that first).
So you're just sitting there unable to do anything usefull until the culprit is killed.
I also never use swap because of this.
Offline
This is called zRam, used to be called compcache. I'm not sure what I should need this for.
Offline
For me swap is useful: I have 3gb ram and 2gb swap (OCZ SSD),I can still use the system with a bit of lag with the swap almost full (fiefox opera with a lot of tabs,amule,thunderbird,amsn etc... with many days of uptime). HD swap would be deadly slow instead.
Offline
I have 16GB, which for some of the work I do isn't quite enough, if you make use of all the memory available to you, swapspace is invaluable. My rule of thumb is twice as much swap as RAM, with half that being on a fast SSD.
I don't really understand why you would want to put swap onto a ramdisk though, it would surely be better to run with no swap and more main memory, unless I am missing something. The kernel will make the best use of the resources available to it.
On a side note, use of ramdisk with swap and hibernation seems to me a recipe for disaster.
Offline