summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorBrian Geffon <bgeffon@google.com>2023-07-14 13:55:05 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-07-24 09:51:59 +0200
commit005e8dddd4978f6243820d031987056a1a88a2dd (patch)
tree14760128ad89ed1eec69436071bd52b7323654d6 /ipc
parent6eaae198076080886b9e7d57f4ae06fa782f90ef (diff)
downloadlinux-stable-005e8dddd4978f6243820d031987056a1a88a2dd.tar.gz
linux-stable-005e8dddd4978f6243820d031987056a1a88a2dd.tar.bz2
linux-stable-005e8dddd4978f6243820d031987056a1a88a2dd.zip
PM: hibernate: don't store zero pages in the image file
On ChromeOS we've observed a considerable number of in-use pages filled with zeros. Today with hibernate it's entirely possible that saveable pages are just zero filled. Since we're already copying pages word-by-word in do_copy_page it becomes almost free to determine if a page was completely filled with zeros. This change introduces a new bitmap which will track these zero pages. If a page is zero it will not be included in the saved image, instead to track these zero pages in the image file we will introduce a new flag which we will set on the packed PFN list. When reading back in the image file we will detect these zero page PFNs and rebuild the zero page bitmap. When the image is being loaded through calls to write_next_page if we encounter a zero page we will silently memset it to 0 and then continue on to the next page. Given the implementation in snapshot_read_next/snapshot_write_next this change will be transparent to non-compressed/compressed and swsusp modes of operation. To provide some concrete numbers from simple ad-hoc testing, on a device which was lightly in use we saw that: PM: hibernation: Image created (964408 pages copied, 548304 zero pages) Of the approximately 6.2GB of saveable pages 2.2GB (36%) were just zero filled and could be tracked entirely within the packed PFN list. The savings would obviously be much lower for lzo compressed images, but even in the case of compression not copying pages across to the compression threads will still speed things up. It's also possible that we would see better overall compression ratios as larger regions of "real data" would improve the compressibility. Finally, such an approach could dramatically improve swsusp performance as each one of those zero pages requires a write syscall to reload, by handling it as part of the packed PFN list we're able to fully avoid that. Signed-off-by: Brian Geffon <bgeffon@google.com> [ rjw: Whitespace adjustments, removal of redundant parentheses ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions