* touch swap space! Except we must write out our image of course. + copy_data_pages(©_bm, &orig_bm, &zero_bm) Pr_info("Need to copy %u pages\n", nr_pages + -2037,19 +2072,23 asmlinkage _visible int swsusp_save(void) + unsigned int nr_pages, nr_highmem, nr_zero_pages + pr_err("Cannot allocate zero bitmap\n") Īlloc_highmem = -2013,11 +2047,12 static int swsusp_alloc(struct memory_bitmap *copy_bm,Īsmlinkage _visible int swsusp_save(void) + error = memory_bm_create(&zero_bm, GFP_IMAGE, PG_ANY) * swsusp_free - Free pages allocated for hibernation -1756,6 +1784,12 int hibernate_preallocate_memory(void) +/* Memory bitmap which tracks which saveable pages were zero filled. + copy_pfn = -1494,6 +1519,9 static struct memory_bitmap orig_bm + /* We will reuse this copy_pfn for a real 'nonzero' page. copy_data_page(memory_bm_next_pfn(copy_bm), pfn) + copy_pfn = memory_bm_next_pfn(copy_bm) Unsigned long -1462,11 +1480,18 static void copy_data_pages(struct memory_bitmap *copy_bm, Static void copy_data_pages(struct memory_bitmap *copy_bm, + return safe_copy_page(page_address(pfn_to_page(dst_pfn)), safe_copy_page(page_address(pfn_to_page(dst_pfn)), +static inline int copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) static inline void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) #define page_is_saveable(zone, pfn) saveable_page(zone, pfn) + ret = safe_copy_page(page_address(d_page), s_page) safe_copy_page(page_address(d_page), s_page) * The page pointed to by src may contain some kernel + for (n = PAGE_SIZE / sizeof(long) n n-) else -1426,30 +1442,32 static void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) for (n = PAGE_SIZE / sizeof(long) n n-) +static inline int do_copy_page(long *dst, long *src) static inline void do_copy_page(long *dst, long *src) Returns 1 if a page was filled with only zeros, otherwise 0. * This is needed, because copy_page and memcpy are not usable for copying Return -1371,14 +1380,18 static unsigned int count_data_pages(void) If (bit cur.zone->start_pfn + bm->cur.node_pfn + bit Void -929,10 +936,12 static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm) Static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn) +static unsigned long memory_bm_get_current(struct memory_bitmap *bm) Int -589,6 +590,7 static void memory_bm_position_reset(struct memory_bitmap *bm)īm->cur.node = list_entry(bm->cur.zone->leaves.next,īm->cur.node_bit = -850,6 +852,11 static void memory_bm_clear_current(struct memory_bitmap *bm) Handling it as part of the packed PFN list we're able to fully avoid It's also possible that we would seeīetter overall compression ratios as larger regions of "real data" wouldįinally, such an approach could dramatically improve swsusp performanceĪs each one of those zero pages requires a write syscall to reload, by In the case of compression not copying pages across to the compression Savings would obviously be much lower for lzo compressed images, but even Of the approximately 6.2GB of saveable pages 2.2GB (36%) were just zeroįilled and could be tracked entirely within the packed PFN list. PM: hibernation: Image created (964408 pages copied, 548304 zero pages) To provide some concrete numbers from simple ad-hoc testing, on a device Snapshot_write_next this change will be transparent to non-compressed,Ĭompressed, and swsusp modes of operation. Given the implementation in snapshot_read_next and When the image is being loaded through calls to snapshot_write_next if weĮncounter a zero page we will silently memset it to 0 and then continue on When reading back in the imageįile we will detect these zero page PFNs and rebuild the zero page bitmap. Which we will set on the packed PFN list. Track these zero pages in the image file we will introduce a new flag If a page is zero it will not be included in the saved image, instead to This change introduces a new bitmap which will track these zero pages. Word-by-word in do_copy_page it becomes almost free to determine if a Today with hibernate it's entirely possible that saveable On ChromeOS we've observed a considerable number of in-use pages filled 19:30 Brian GeffonĠ siblings, 2 replies 7+ messages in threadĬc: Pavel Machek, Len Brown, linux-pm, linux-kernel, Brian Geffon All of help / color / mirror / Atom feed * PM: hibernate: don't store zero pages in the image file. PM: hibernate: don't store zero pages in the image file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |