diff options
Diffstat (limited to 'kernel/power/snapshot.c')
-rw-r--r-- | kernel/power/snapshot.c | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index c4b8093c80b3..f1604d8cf489 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -725,14 +725,6 @@ static void memory_bm_clear_bit(struct memory_bitmap *bm, unsigned long pfn) | |||
725 | clear_bit(bit, addr); | 725 | clear_bit(bit, addr); |
726 | } | 726 | } |
727 | 727 | ||
728 | static void memory_bm_clear_current(struct memory_bitmap *bm) | ||
729 | { | ||
730 | int bit; | ||
731 | |||
732 | bit = max(bm->cur.node_bit - 1, 0); | ||
733 | clear_bit(bit, bm->cur.node->data); | ||
734 | } | ||
735 | |||
736 | static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn) | 728 | static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn) |
737 | { | 729 | { |
738 | void *addr; | 730 | void *addr; |
@@ -1341,35 +1333,23 @@ static struct memory_bitmap copy_bm; | |||
1341 | 1333 | ||
1342 | void swsusp_free(void) | 1334 | void swsusp_free(void) |
1343 | { | 1335 | { |
1344 | unsigned long fb_pfn, fr_pfn; | 1336 | struct zone *zone; |
1345 | 1337 | unsigned long pfn, max_zone_pfn; | |
1346 | memory_bm_position_reset(forbidden_pages_map); | ||
1347 | memory_bm_position_reset(free_pages_map); | ||
1348 | |||
1349 | loop: | ||
1350 | fr_pfn = memory_bm_next_pfn(free_pages_map); | ||
1351 | fb_pfn = memory_bm_next_pfn(forbidden_pages_map); | ||
1352 | |||
1353 | /* | ||
1354 | * Find the next bit set in both bitmaps. This is guaranteed to | ||
1355 | * terminate when fb_pfn == fr_pfn == BM_END_OF_MAP. | ||
1356 | */ | ||
1357 | do { | ||
1358 | if (fb_pfn < fr_pfn) | ||
1359 | fb_pfn = memory_bm_next_pfn(forbidden_pages_map); | ||
1360 | if (fr_pfn < fb_pfn) | ||
1361 | fr_pfn = memory_bm_next_pfn(free_pages_map); | ||
1362 | } while (fb_pfn != fr_pfn); | ||
1363 | |||
1364 | if (fr_pfn != BM_END_OF_MAP && pfn_valid(fr_pfn)) { | ||
1365 | struct page *page = pfn_to_page(fr_pfn); | ||
1366 | 1338 | ||
1367 | memory_bm_clear_current(forbidden_pages_map); | 1339 | for_each_populated_zone(zone) { |
1368 | memory_bm_clear_current(free_pages_map); | 1340 | max_zone_pfn = zone_end_pfn(zone); |
1369 | __free_page(page); | 1341 | for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) |
1370 | goto loop; | 1342 | if (pfn_valid(pfn)) { |
1343 | struct page *page = pfn_to_page(pfn); | ||
1344 | |||
1345 | if (swsusp_page_is_forbidden(page) && | ||
1346 | swsusp_page_is_free(page)) { | ||
1347 | swsusp_unset_page_forbidden(page); | ||
1348 | swsusp_unset_page_free(page); | ||
1349 | __free_page(page); | ||
1350 | } | ||
1351 | } | ||
1371 | } | 1352 | } |
1372 | |||
1373 | nr_copy_pages = 0; | 1353 | nr_copy_pages = 0; |
1374 | nr_meta_pages = 0; | 1354 | nr_meta_pages = 0; |
1375 | restore_pblist = NULL; | 1355 | restore_pblist = NULL; |