From: Luigi Semenzato <semenzato@google.com>
To: linux-mm@kvack.org
Cc: Luigi Semenzato <semenzato@google.com>
Subject: [PATCH 2/2] pm: add more logging on hibernation failure
Date: Fri, 27 Dec 2019 13:34:39 -0800 [thread overview]
Message-ID: <20191227213439.139123-3-semenzato@google.com> (raw)
In-Reply-To: <20191227213439.139123-1-semenzato@google.com>
Hibernation fails when the kernel cannot allocate enough memory
to copy all pages in use. This patch ensures that the failure
reason is clearly logged.
Signed-off-by: Luigi Semenzato <semenzato@google.com>
---
kernel/power/snapshot.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 26b9168321e7..df498717a97e 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1705,16 +1705,20 @@ int hibernate_preallocate_memory(void)
ktime_t start, stop;
int error;
- pr_info("Preallocating image memory... ");
+ pr_info("Preallocating hibernation image memory\n");
start = ktime_get();
error = memory_bm_create(&orig_bm, GFP_IMAGE, PG_ANY);
- if (error)
+ if (error) {
+ pr_err("Cannot allocate original bitmap\n");
goto err_out;
+ }
error = memory_bm_create(©_bm, GFP_IMAGE, PG_ANY);
- if (error)
+ if (error) {
+ pr_err("Cannot allocate copy bitmap\n");
goto err_out;
+ }
alloc_normal = 0;
alloc_highmem = 0;
@@ -1804,8 +1808,11 @@ int hibernate_preallocate_memory(void)
alloc -= pages;
pages += pages_highmem;
pages_highmem = preallocate_image_highmem(alloc);
- if (pages_highmem < alloc)
+ if (pages_highmem < alloc) {
+ pr_err("Image allocation is %lu pages short\n",
+ alloc - pages_highmem);
goto err_out;
+ }
pages += pages_highmem;
/*
* size is the desired number of saveable pages to leave in
@@ -1836,13 +1843,12 @@ int hibernate_preallocate_memory(void)
out:
stop = ktime_get();
- pr_cont("done (allocated %lu pages)\n", pages);
+ pr_info("Allocated %lu pages for hibernation shapshot\n", pages);
swsusp_show_speed(start, stop, pages, "Allocated");
return 0;
err_out:
- pr_cont("\n");
swsusp_free();
return -ENOMEM;
}
--
2.24.1.735.g03f4e72817-goog
next prev parent reply other threads:[~2019-12-27 21:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-27 21:34 [PATCH 0/2] clarify limitations of hibernation Luigi Semenzato
2019-12-27 21:34 ` [PATCH 1/2] Documentation: " Luigi Semenzato
2019-12-28 0:23 ` Chris Down
2019-12-28 0:25 ` Chris Down
2020-01-02 19:29 ` Luigi Semenzato
2019-12-27 21:34 ` Luigi Semenzato [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-12-26 22:02 [PATCH 0/2] " Luigi Semenzato
2019-12-26 22:02 ` [PATCH 2/2] pm: add more logging on hibernation failure Luigi Semenzato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191227213439.139123-3-semenzato@google.com \
--to=semenzato@google.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox