linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] mm/memory-failure: refactor log format in unpoison_memory
@ 2024-06-19  6:33 Jiaqi Yan
  2024-06-24  2:57 ` Miaohe Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Jiaqi Yan @ 2024-06-19  6:33 UTC (permalink / raw)
  To: nao.horiguchi, linmiaohe
  Cc: jane.chu, ioworker0, akpm, osalvador, linux-mm, Jiaqi Yan

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.

Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>
---
 mm/memory-failure.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index d3c830e817e3..3a3ba8ad1745 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -2502,7 +2502,7 @@ static int __init memory_failure_init(void)
 core_initcall(memory_failure_init);
 
 #undef pr_fmt
-#define pr_fmt(fmt)	"" fmt
+#define pr_fmt(fmt) "Unpoison: " fmt
 #define unpoison_pr_info(fmt, pfn, rs)			\
 ({							\
 	if (__ratelimit(rs))				\
@@ -2540,27 +2540,27 @@ int unpoison_memory(unsigned long pfn)
 	mutex_lock(&mf_mutex);
 
 	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);
 		ret = -EOPNOTSUPP;
 		goto unlock_mutex;
 	}
 
 	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);
 		ret = -EOPNOTSUPP;
 		goto unlock_mutex;
 	}
 
 	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);
 		goto unlock_mutex;
 	}
 
 	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);
 		goto unlock_mutex;
 	}
@@ -2574,13 +2574,13 @@ int unpoison_memory(unsigned long pfn)
 	 * in folio_mapped() has to be done after folio_test_slab() is checked.
 	 */
 	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);
 		goto unlock_mutex;
 	}
 
 	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);
 		goto unlock_mutex;
 	}
@@ -2599,7 +2599,7 @@ int unpoison_memory(unsigned long pfn)
 			ret = put_page_back_buddy(p) ? 0 : -EBUSY;
 		} else {
 			ret = ghp;
-			unpoison_pr_info("Unpoison: failed to grab page %#lx\n",
+			unpoison_pr_info("%#lx: failed to grab page\n",
 					 pfn, &unpoison_rs);
 		}
 	} else {
@@ -2624,7 +2624,7 @@ int unpoison_memory(unsigned long pfn)
 	if (!ret) {
 		if (!huge)
 			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);
 	}
 	return ret;
-- 
2.45.2.627.g7a2c4fd464-goog



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] mm/memory-failure: refactor log format in unpoison_memory
  2024-06-19  6:33 [PATCH v1] mm/memory-failure: refactor log format in unpoison_memory Jiaqi Yan
@ 2024-06-24  2:57 ` Miaohe Lin
  2024-06-24 16:20   ` Jiaqi Yan
  0 siblings, 1 reply; 3+ messages in thread
From: Miaohe Lin @ 2024-06-24  2:57 UTC (permalink / raw)
  To: Jiaqi Yan; +Cc: jane.chu, ioworker0, akpm, osalvador, linux-mm, Naoya Horiguchi

On 2024/6/19 14:33, Jiaqi Yan wrote:
> 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.
> 
> Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>

LGTM. Thanks for your patch.

Acked-by: Miaohe Lin <linmiaohe@huawei.com>
Thanks.
.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] mm/memory-failure: refactor log format in unpoison_memory
  2024-06-24  2:57 ` Miaohe Lin
@ 2024-06-24 16:20   ` Jiaqi Yan
  0 siblings, 0 replies; 3+ messages in thread
From: Jiaqi Yan @ 2024-06-24 16:20 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: jane.chu, ioworker0, akpm, osalvador, linux-mm, Naoya Horiguchi

On Sun, Jun 23, 2024 at 7:57 PM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> On 2024/6/19 14:33, Jiaqi Yan wrote:
> > 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.
> >
> > Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>
>
> LGTM. Thanks for your patch.

No problem ;)

>
> Acked-by: Miaohe Lin <linmiaohe@huawei.com>

Thanks Miaohe!

> Thanks.
> .


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-24 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-19  6:33 [PATCH v1] mm/memory-failure: refactor log format in unpoison_memory Jiaqi Yan
2024-06-24  2:57 ` Miaohe Lin
2024-06-24 16:20   ` Jiaqi Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox