I used SmartSleep for a long time to control my MacBook Pro's sleeping habits. I've finally discovered that this utility doesn't work with Secure Virtual Memory. First, some background.
There are essentially 2 ways a Mac can sleep. The first is 'regular sleep', or for you Windows users, suspend. In this mode the computer saves power by shutting down peripheral hardware (like the disks, screen and keyboard light) while keeping the processor in a low power state. The battery is used to keep the RAM powered so that when you resume (ie. open the lid) the computer can turn everything back on and start right back where it left off.
The second is called 'safe sleep'. This is like hibernate mode for Windows users. In this mode the computer RAM and processor state is written out to disk and the computer is turned off. Obviously this is very power efficient (off == good for battery life!). The problem with this mode is that when you want to use the computer you have to wait a LONG time for the resume process to complete. On my machine I have 8 GB of RAM (on a laptop - how far we've come!). It takes almost 2 minutes to resume my machine in safe sleep.
SmartSleep is supposed to let you control and choose these modes. There is also a hybrid mode that will suspend AND hibernate, but only power down the machine if the battery goes too low. If the battery is removed or dies, you can then resume like you did from a hibernate. It takes a long time but it works and you loose no data. In the best case it resumes quickly because the state of the processor/RAM was preserved by the battery power.
Now enters Secure Virtual Memory. I use this setting because I don't want data like key material and passwords leaking into my swap file. It has almost no impact on performance and in the case that my laptop is stolen or captured at the border it will protect my privacy rights. You can turn on Secure Virtual Memory in the Security System Preferences Pane.
SmartSleep doesn't take the Secure Virtual Memory setting into account. This means that if you have it turned on it sets the hibernatemode option incorrectly. When my machine goes into safe-sleep, it can't recover and I'm forced to reboot (and loose data!). Here is the settings that should be used:
The hibernatemode option in power management settings selects the suspend policy: $ sudo pmset -a hibernatemode 0 always regular sleep (disable safe-sleep) $ sudo pmset -a hibernatemode 1 always safe-sleep (disable regular sleep) $ sudo pmset -a hibernatemode 3 regular sleep first, safe-sleep if the battery is very low on power or is unplugged $ sudo pmset -a hibernatemode 5 always safe-sleep with secure virtual memory $ sudo pmset -a hibernatemode 7 regular sleep first then safe-sleep with secure virtual memoryTo find out what setting you are currently just type:
pmset -g | grep hibernatemode
I've uninstalled SmartSleep for now and will send this feedback to the author to see if it can be fixed.
5 and 7 are now deprecated DO NOT USE. See latest pmset man page for info.
ReplyDelete