Skip to content

Commit d3db87f

Browse files
committed
PM: hibernate: Rework message printing in swsusp_save()
The messages printed by swsusp_save() are basically only useful for debug, so printing them every time a hibernation image is created at the "info" log level is not particularly useful. Also printing a message on a failing memory allocation is redundant. Use pm_deferred_pr_dbg() for printing those messages so they will only be printed when requested and the "deferred" variant is used because this code runs in a deeply atomic context (one CPU with interrupts off, no functional devices). Also drop the useless message printed when memory allocations fails. While at it, extend one of the messages in question so it is less cryptic. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> [ rjw: Dropped a useless colon at the end of one of the messages ] Link: https://patch.msgid.link/10750389.nUPlyArG6x@rafael.j.wysocki
1 parent a67818f commit d3db87f

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

kernel/power/snapshot.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,22 +2110,20 @@ asmlinkage __visible int swsusp_save(void)
21102110
{
21112111
unsigned int nr_pages, nr_highmem;
21122112

2113-
pr_info("Creating image:\n");
2113+
pm_deferred_pr_dbg("Creating image\n");
21142114

21152115
drain_local_pages(NULL);
21162116
nr_pages = count_data_pages();
21172117
nr_highmem = count_highmem_pages();
2118-
pr_info("Need to copy %u pages\n", nr_pages + nr_highmem);
2118+
pm_deferred_pr_dbg("Need to copy %u pages\n", nr_pages + nr_highmem);
21192119

21202120
if (!enough_free_mem(nr_pages, nr_highmem)) {
2121-
pr_err("Not enough free memory\n");
2121+
pm_deferred_pr_dbg("Not enough free memory for image creation\n");
21222122
return -ENOMEM;
21232123
}
21242124

2125-
if (swsusp_alloc(&copy_bm, nr_pages, nr_highmem)) {
2126-
pr_err("Memory allocation failed\n");
2125+
if (swsusp_alloc(&copy_bm, nr_pages, nr_highmem))
21272126
return -ENOMEM;
2128-
}
21292127

21302128
/*
21312129
* During allocating of suspend pagedir, new cold pages may appear.
@@ -2144,7 +2142,8 @@ asmlinkage __visible int swsusp_save(void)
21442142
nr_zero_pages = nr_pages - nr_copy_pages;
21452143
nr_meta_pages = DIV_ROUND_UP(nr_pages * sizeof(long), PAGE_SIZE);
21462144

2147-
pr_info("Image created (%d pages copied, %d zero pages)\n", nr_copy_pages, nr_zero_pages);
2145+
pm_deferred_pr_dbg("Image created (%d pages copied, %d zero pages)\n",
2146+
nr_copy_pages, nr_zero_pages);
21482147

21492148
return 0;
21502149
}

0 commit comments

Comments
 (0)