Skip to contentSkip to conversation

PM/hibernate: Free memory occupied by the memory bitmap when hibernation failed

PATCH New BaoJun Luo 2 participants 2 messages May 22, 2017 – Jun 29, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20170522054414epcas1p38b221b576b6f304c911a196457e248fe@epcas1p3.samsung.com

BaoJun Luo

author
#1 lore raw

PATCH 1/1 PM/hibernate: Free memory occupied by the memory bitmap when hibernation failed

Quoted 1 line

From 17f24d918f4c2ac292ec2aaeb13a527a10b91f80 Mon Sep 17 00:00:00 2001

From: "baojun.luo" <[email protected]>
Date: Fri, 19 May 2017 17:58:21 +0800
Subject: [PATCH] PM/hibernate: Free memory bitmap by orig_bm/copy_bm hold when hibernation failed

During prepare for hibernation operation, if there is an error, the image bitmap memory needs to be released.

This patch will make sure the bitmap memory be released when hibernation error

---
 kernel/power/hibernate.c |  1 +
 kernel/power/power.h     |  1 +
 kernel/power/snapshot.c  | 50 +++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 43 insertions(+), 9 deletions(-)
kernel/power/hibernate.c +1 -0
@@ -743,6 +743,7 @@ int hibernate(void)
 	}
 
  Free_bitmaps:
+	free_image_memory_bitmaps();
 	free_basic_memory_bitmaps();
  Thaw:
 	unlock_device_hotplug();
kernel/power/power.h +1 -0
@@ -108,6 +108,7 @@ static inline void hibernate_image_size_init(void) {}
 
 extern int create_basic_memory_bitmaps(void);
 extern void free_basic_memory_bitmaps(void);
+extern void free_image_memory_bitmaps(void);
 extern int hibernate_preallocate_memory(void);
 
 extern void clear_free_pages(void);
kernel/power/snapshot.c +41 -9

68 lines not on this page · raw message

--
1.9.1

A message that is not in the archive (sent off-list or not yet received): "002101d2d2be$71fc1210$55f43630$@luo"@samsung.com

#3 lore raw
Quoted 8 lines · BaoJun Luo

From 17f24d918f4c2ac292ec2aaeb13a527a10b91f80 Mon Sep 17 00:00:00 2001
From: "baojun.luo" <[email protected]>
Date: Fri, 19 May 2017 17:58:21 +0800
Subject: [PATCH] PM/hibernate: Free memory bitmap by orig_bm/copy_bm hold when hibernation failed

During prepare for hibernation operation, if there is an error, the image bitmap memory needs to be released.

This patch will make sure the bitmap memory be released when hibernation error

They will be released by swsusp_free(), because the pages used by them are marked as "image pages".

At least that's what is supposed to happen, maybe it does not work correctly, but in that case it needs to be fixed instead of worked around.

Thanks,
Rafael