Friday, 3 February 2017

zeromemory: zero free RAM to speedup Intel Rapid Start Technology on linux

If you tried the Intel Rapid Start Technology (IRST) on linux, you probably found that it is not Rapid at all. This is because linux uses all the available memory to hold file buffers, but it does not seem to prune any page before entering sleep mode, so the firmware saves the whole memory on disk. Usually, this is much slower than software hibernation.

zeromemory is similar to disk scrubbing applications, only it does that in RAM. And, it is very fast because memory isn't actually zeroed in userspace, but pages are just claimed and the kernel cleans them for us, very fast.
This is useful for IRST because the firmware appears to compress pages, and an all-zero page is dramatically faster to write on disk (maybe it is even discarded wholly).

So, to speed up IRST, you first enable it, then run:

  git clone
  cd zeromemory
  sudo make install
  sudo systemctl enable zeromemory-presleep

and you should have now a Rapid IRST.

This program probably also helps in shrinking snapshots of virtual machines. Note that this is not a safe scrubbing program, that is it does not guarantee that every single unused memory page is cleared.