Commit 5cea5666 authored by Jiaqi Yan's avatar Jiaqi Yan Committed by Andrew Morton

mm/memory-failure: refactor log format in unpoison_memory

Logs from memory_failure and other memory-failure.c code follow the
format:

  "Memory failure: 0x{pfn}: ${lower_case_message}"

Convert the logs in unpoison_memory to follow similar format:

  "Unpoison: 0x${pfn}: ${lower_case_message}"

For example (from local test):
  [ 1331.938397] Unpoison: 0x144bc8: page was already unpoisoned

No functional change in this commit.

Link: https://lkml.kernel.org/r/20240619063355.171313-1-jiaqiyan@google.comSigned-off-by: default avatarJiaqi Yan <jiaqiyan@google.com>
Acked-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Cc: Jane Chu <jane.chu@oracle.com>
Cc: Lance Yang <ioworker0@gmail.com>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 34f7c528
...@@ -2515,7 +2515,7 @@ static int __init memory_failure_init(void) ...@@ -2515,7 +2515,7 @@ static int __init memory_failure_init(void)
core_initcall(memory_failure_init); core_initcall(memory_failure_init);
#undef pr_fmt #undef pr_fmt
#define pr_fmt(fmt) fmt #define pr_fmt(fmt) "Unpoison: " fmt
#define unpoison_pr_info(fmt, pfn, rs) \ #define unpoison_pr_info(fmt, pfn, rs) \
({ \ ({ \
if (__ratelimit(rs)) \ if (__ratelimit(rs)) \
...@@ -2553,27 +2553,27 @@ int unpoison_memory(unsigned long pfn) ...@@ -2553,27 +2553,27 @@ int unpoison_memory(unsigned long pfn)
mutex_lock(&mf_mutex); mutex_lock(&mf_mutex);
if (hw_memory_failure) { if (hw_memory_failure) {
unpoison_pr_info("Unpoison: Disabled after HW memory failure %#lx\n", unpoison_pr_info("%#lx: disabled after HW memory failure\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto unlock_mutex; goto unlock_mutex;
} }
if (is_huge_zero_folio(folio)) { if (is_huge_zero_folio(folio)) {
unpoison_pr_info("Unpoison: huge zero page is not supported %#lx\n", unpoison_pr_info("%#lx: huge zero page is not supported\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto unlock_mutex; goto unlock_mutex;
} }
if (!PageHWPoison(p)) { if (!PageHWPoison(p)) {
unpoison_pr_info("Unpoison: Page was already unpoisoned %#lx\n", unpoison_pr_info("%#lx: page was already unpoisoned\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
goto unlock_mutex; goto unlock_mutex;
} }
if (folio_ref_count(folio) > 1) { if (folio_ref_count(folio) > 1) {
unpoison_pr_info("Unpoison: Someone grabs the hwpoison page %#lx\n", unpoison_pr_info("%#lx: someone grabs the hwpoison page\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
goto unlock_mutex; goto unlock_mutex;
} }
...@@ -2583,13 +2583,13 @@ int unpoison_memory(unsigned long pfn) ...@@ -2583,13 +2583,13 @@ int unpoison_memory(unsigned long pfn)
goto unlock_mutex; goto unlock_mutex;
if (folio_mapped(folio)) { if (folio_mapped(folio)) {
unpoison_pr_info("Unpoison: Someone maps the hwpoison page %#lx\n", unpoison_pr_info("%#lx: someone maps the hwpoison page\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
goto unlock_mutex; goto unlock_mutex;
} }
if (folio_mapping(folio)) { if (folio_mapping(folio)) {
unpoison_pr_info("Unpoison: the hwpoison page has non-NULL mapping %#lx\n", unpoison_pr_info("%#lx: the hwpoison page has non-NULL mapping\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
goto unlock_mutex; goto unlock_mutex;
} }
...@@ -2608,7 +2608,7 @@ int unpoison_memory(unsigned long pfn) ...@@ -2608,7 +2608,7 @@ int unpoison_memory(unsigned long pfn)
ret = put_page_back_buddy(p) ? 0 : -EBUSY; ret = put_page_back_buddy(p) ? 0 : -EBUSY;
} else { } else {
ret = ghp; ret = ghp;
unpoison_pr_info("Unpoison: failed to grab page %#lx\n", unpoison_pr_info("%#lx: failed to grab page\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
} }
} else { } else {
...@@ -2633,7 +2633,7 @@ int unpoison_memory(unsigned long pfn) ...@@ -2633,7 +2633,7 @@ int unpoison_memory(unsigned long pfn)
if (!ret) { if (!ret) {
if (!huge) if (!huge)
num_poisoned_pages_sub(pfn, 1); num_poisoned_pages_sub(pfn, 1);
unpoison_pr_info("Unpoison: Software-unpoisoned page %#lx\n", unpoison_pr_info("%#lx: software-unpoisoned page\n",
page_to_pfn(p), &unpoison_rs); page_to_pfn(p), &unpoison_rs);
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment