Re: Thinking aloud.
Theodore Ts'o <[email protected]> Sun, 21 Oct 2012 22:27:42 -0400
| Newsgroups | gmane.linux.swsusp.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Oct 20, 2012 at 08:20:28AM +1100, Nigel Cunningham wrote: > > My initial thought is to use SHA1 checksums to determine what pages > have changed, keeping those checksums (and the pfns to which they > refer) in memory or on disk between hibernation cycles. Hi Nigel, One thought --- if you are on a 64-bit machine, where we don't have a shortage of page flags, you could set a new flag on all pages that were saved during the last hibernate cycle, and on the restore, mark all pages in the page table read/only. As the pages get modified, on the page fault, clear the flag. This should be a lot faster than burning the memory bandwidth and computational resources needed to calculate SHA1 checksums on all memory pages which are in use. If you can't do this approach, something else that would probably worth doing is using a two-pass checksum; first use a very fast checksum, such as Adler-32 or Fletcher-32, which is memory bandwidth limited. If the fast-but-not-entirely checksum doesn't match, there's no point trying to doing the (much slower) SHA1 checksum over the page; you'll know that the page has changed. If the fast checksum matches, then you can do a second pass with SHA1 to make sure you can really skip doing the disk write. Regards, - Ted