Skip to main content
Welcome guest. | Register | Login | Post

Suspend to disk - does it still make sense?

I just ran into this question and thought I'll post it here to see what others think.
My personal opinion is that it doesn't, and here's why:

I have 8GB of RAM, and although most of it usually is free (or just used by the cache and thus free-able in case of suspension) I have situations where I actually use a lot of my memory for stuff I'm doing. May it be rendering with Blender or virtualization, there are things which really can eat up my memory.
Now having so much memory is a nice thing, for several reasons. One reason is reduced swapping. I have 4GB of swap-space. Right now the Linux-kernel for some reason thinks that it should occupy 2MB of that space, although I still have 45MB free RAM (plus roughly 5.2GB which are currently used for cache and buffers).

The problem I have now is that in case I have to suspend to disk (for whatever reason) under full memory load (and I mean one of those really rare cases where memory is actually occupied, not by cache and buffers) my swap-space, which is half the size of my physical memory, would not be big enough to hold all the data.

Now this all still made sense in times where we used to say "have twice as much swap-space as you have physical RAM", but those were times where 1GB of memory was a lot! And back then swapping was a lot more common than it is now, with lots of RAM in our boxes. But seriously, why should I now have 16GB or even just 8GB (to match my physical RAM) of swap-space when I hardly ever see any mentionable amount used. As said, 2MB are in use right now. Wow!

So the problem is that with the amount of physical RAM growing people see less reason for huge swap-space, as it usually isn't needed. But then you are at risk that in situations where all your memory actually is in use you will not be able to suspend to disk.

Now does that mean we should kill that possibility? No, certainly not. One reason clearly is that Linux, due to it's flexibility, can run on machines with fewer resources than a recent desktop-/gaming-machine. For those boxes suspend to disk still is a possibility. The other reason is that, although people now have lots of RAM, most of it is not really in use most of the time. Also I think it is quite unlikely somebody would want to suspend their box while rendering and running 2 VMs. ;-)

So, in conclusion I want to say that although there are situations where on a box with lots of RAM suspend to disk may fail, those situations still are quite unlikely to come by.
But although those situations are unlikely, they are not impossible to encounter, thus suspend to disk always has to be handled with care. And you never know what may happen that you suddenly have no option other than sending your PC to sleep.

What do you guys think?

Comments

I never really used this feature other than for trying it out of curiosity, but what you say makes sense, especially if all those gigabytes of swap could be used more productively for something else. Otherwise, and only if you actually see yourself using it, I guess it wouldn't hurt to have the option around and just have that swap space big enough to hold it.

But as you say that's probably a rarity.

Re: Suspend to disk - does it still make sense?

 

Although there are many Desktop users that use the Suspend to Disc feature. It is primarily designed for and used by Laptop and Netbook users. Suspend to Disc is almost as important to a Laptop as the Keyboard is. Neither are 100% required (You can always use the mouse/touchpad and a Character map), but if given the choice you wouldnt go without either.

Re: Suspend to disk - does it still make sense?

 

Until we get to where the suspend to disk feature can use something (like Windows) other than the swap file, and you want to use all your RAM you'll need 8 GB of swap space.

However, my question is the reverse, with the large size of hard drives in laptops why are we worried about 8 GB? If you have enough money to have 8 GB of RAM you should have enough money to buy a hard drive big enough to make 8 GB a tiny portion. Except in your case you're only talking about 4 more GB. Not only that but I'd still venture to say that those with more than 4 GB of RAM are rare indeed, mine only has 2 GB, and runs very well. And, if you're talking about a desktop that's plugged in the wall full time, why suspend to disk, if suspend to RAM works? It takes the machine off-line, preserves the running state, and is quicker to wake up, IF suspend to RAM works on your PC. (It doesn't on my laptop I have to suspend to disk).

Back to my original line. I would like to see Linux be able to use a dynamically sized virtual file, kind of like a VMware virtual disk, instead of swap space for it's suspension. Then it truly wouldn't make since to have 8 GB of swap space.

Re: Suspend to disk - does it still make sense?

 

I was thinking about this the other day myself; I only have 2 GB of RAM on my laptop, but it seems like it takes almost as long to suspend to disk and resume from disk as it does to shut down and boot again (not to mention that all kinds of programs don't deal well with being suspended). And theoretically, that time will only get longer the more RAM I have.

I don't know how suspend to RAM works under the hood, or how optimized it is; but it seems to me that in theory it's more efficient to boot. When I boot, my computer only reads from the disk as much data as it needs to boot; when I resume from S2D, I assume it has to read in the whole amount of the RAM. With 4+GB of RAM, that seems like a bad idea. I doubt my computer has to read anything close to that from the disk when it boots. Heck, my entire / partition (including /usr) is only 5.6 GB!

It seems to me that S2D only makes sense when:
- Processor power is a major bottleneck
- RAM size is fairly low
- Disk read/write is comparably fast

I could be way off base here, but with newer laptops it seems to be the reverse: RAM size is huge, Disk read/write is the major bottleneck, and processor power is cheap.

Re: Suspend to disk - does it still make sense?

 

Unlike Suspend to Ram, Suspend to Disk survives power interruptions.

Re: Suspend to disk - does it still make sense?

 

I think that if there is one reason good enough to keep swap and s2disk functional, it's the above! Surviving power outages. I only use standby and mem regularly to suspend, but if suddenly the weather got bad or whatever, and/or I were running off a UPS, and wanted a quick safe shutoff but not to have to reopen and restart everything after, I'd like to know that suspending to disk was possible and working.
Sas

 
Quote:

However, my question is the reverse, with the large size of hard drives in laptops why are we worried about 8 GB? If you have enough money to have 8 GB of RAM you should have enough money to buy a hard drive big enough to make 8 GB a tiny portion.

Well, I'm not talking about my laptop, which only has 1GB of RAM and 2GB of swap, but my PC. And yes, my hard-disk is big enough. I have recently installed a 640GB hard-disk, so yes, I could simply give a shit about wasting a few gigs. But I don't. As much as I dislike leaving space unpartitioned in case I want to try another distro (which is why I use virtualization for that) I dislike wasting space on swap I won't use.

Quote:

And, if you're talking about a desktop that's plugged in the wall full time, why suspend to disk, if suspend to RAM works?

As said, there may be situations where you don't have a choice. As was said here:

Quote:

Unlike Suspend to Ram, Suspend to Disk survives power interruptions.

Quote:

Surviving power outages. I only use standby and mem regularly to suspend, but if suddenly the weather got bad or whatever, and/or I were running off a UPS, and wanted a quick safe shutoff but not to have to reopen and restart everything after, I'd like to know that suspending to disk was possible and working.

Re: Suspend to disk - does it still make sense?

 

With solid state disks gettting cheaper by the day (approx £100 for 30Gb in the UK), using one for OS/swap on a large RAM desktop based system seems like a good idea. For S2D this would mean very fast suspend/resume times and improved swap performance.

As previously stated, if you have enough free cash for 8Gb of memory, then you're probably rich enough to consider an SSD for OS/Swap. This would make an 8Gb RAM system almost useable with S2D.

It's something I've been considereding to save power as I un my main desktop constantly. I could quickly S2D and resume.

Re: Suspend to disk - does it still make sense?

 

I love suspend to disk. I too have 8GB of memory and have knowingly and happily provided 16GB of swap space to make it happy. I personally think this is a very small price to pay for the suspend to disk functionality. I dual boot but use my GNU/Linux distro to do the bulk of my work. I usually have plenty of stuff opened with everything organized onto its own workspace. Its a beautiful thing to sort of deep freeze your desktop, unplug and travel hundreds of miles away, plug back in and start off exactly where you left off. My main concerns are two-fold though. One, I dual boot into a Windows partition and hate having to shut down my desktop to do it. Two, hibernating takes about 4x longer than just shutting down but restarting it and having every pixel exactly where I left it is priceless. My only gripe about hibernation in GNU/Linux is how un-verbose it is right now. You basically stare at a blank screen and if you're lucky a wildly entertaining blinking underscore.

 
Anonymous wrote:

As previously stated, if you have enough free cash for 8Gb of memory, then you're probably rich enough to consider an SSD for OS/Swap. This would make an 8Gb RAM system almost useable with S2D.

I cannot understand this argument. Why would I need to be rich in order to have 8GB of RAM? I paid like 60 euro for 4 x 2GB Kingston DDR2-800. Which still is considerably less (about half) of what you mention for a 30GB SSD.

You say this:

Quote:

(approx £100 for 30Gb in the UK)

So 100 pounds are (according to Google) around 115 euro. For 30GB that's a lot. I have paid about 40 euro for my 640GB SATA2-hard-drive. Okay, I know that SSD still is more expensive, but if I pay for 30GB hard-drive-space twice as much as I pay for 8GB of RAM then I wanna use every bit of it as good as possible, and not waste the precious space.

So, as said, I don't understand your reasoning. You don't need to be rich