diff mbox series

[v7,1/4] mm/memory-failure: refactor log format in soft offline code

Message ID 20240628205958.2845610-2-jiaqiyan@google.com (mailing list archive)
State New
Headers show
Series Userspace controls soft-offline pages | expand

Commit Message

Jiaqi Yan June 28, 2024, 8:59 p.m. UTC
Logs from soft_offline_page and soft_offline_in_use_page have
different formats than majority of the memory failure code:

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

Convert them to the following format:

  "Soft offline: 0x${pfn}: ${lower_case_message}"

No functional change in this commit.

Acked-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>
---
 mm/memory-failure.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Lance Yang June 30, 2024, 10:44 a.m. UTC | #1
On Sat, Jun 29, 2024 at 5:00 AM Jiaqi Yan <jiaqiyan@google.com> wrote:
>
> Logs from soft_offline_page and soft_offline_in_use_page have
> different formats than majority of the memory failure code:
>
>   "Memory failure: 0x${pfn}: ${lower_case_message}"
>
> Convert them to the following format:
>
>   "Soft offline: 0x${pfn}: ${lower_case_message}"
>
> No functional change in this commit.
>
> Acked-by: Miaohe Lin <linmiaohe@huawei.com>
> Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>

LGTM. Feel free to add:
Reviewed-by: Lance Yang <ioworker0@gmail.com>

Thanks,
Lance


> ---
>  mm/memory-failure.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 2cf7acc286de..685ab9a77966 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -2640,6 +2640,9 @@ int unpoison_memory(unsigned long pfn)
>  }
>  EXPORT_SYMBOL(unpoison_memory);
>
> +#undef pr_fmt
> +#define pr_fmt(fmt) "Soft offline: " fmt
> +
>  static bool mf_isolate_folio(struct folio *folio, struct list_head *pagelist)
>  {
>         bool isolated = false;
> @@ -2695,7 +2698,7 @@ static int soft_offline_in_use_page(struct page *page)
>
>         if (!huge && folio_test_large(folio)) {
>                 if (try_to_split_thp_page(page, true)) {
> -                       pr_info("soft offline: %#lx: thp split failed\n", pfn);
> +                       pr_info("%#lx: thp split failed\n", pfn);
>                         return -EBUSY;
>                 }
>                 folio = page_folio(page);
> @@ -2707,7 +2710,7 @@ static int soft_offline_in_use_page(struct page *page)
>         if (PageHWPoison(page)) {
>                 folio_unlock(folio);
>                 folio_put(folio);
> -               pr_info("soft offline: %#lx page already poisoned\n", pfn);
> +               pr_info("%#lx: page already poisoned\n", pfn);
>                 return 0;
>         }
>
> @@ -2720,7 +2723,7 @@ static int soft_offline_in_use_page(struct page *page)
>         folio_unlock(folio);
>
>         if (ret) {
> -               pr_info("soft_offline: %#lx: invalidated\n", pfn);
> +               pr_info("%#lx: invalidated\n", pfn);
>                 page_handle_poison(page, false, true);
>                 return 0;
>         }
> @@ -2737,13 +2740,13 @@ static int soft_offline_in_use_page(struct page *page)
>                         if (!list_empty(&pagelist))
>                                 putback_movable_pages(&pagelist);
>
> -                       pr_info("soft offline: %#lx: %s migration failed %ld, type %pGp\n",
> +                       pr_info("%#lx: %s migration failed %ld, type %pGp\n",
>                                 pfn, msg_page[huge], ret, &page->flags);
>                         if (ret > 0)
>                                 ret = -EBUSY;
>                 }
>         } else {
> -               pr_info("soft offline: %#lx: %s isolation failed, page count %d, type %pGp\n",
> +               pr_info("%#lx: %s isolation failed, page count %d, type %pGp\n",
>                         pfn, msg_page[huge], page_count(page), &page->flags);
>                 ret = -EBUSY;
>         }
> @@ -2795,7 +2798,7 @@ int soft_offline_page(unsigned long pfn, int flags)
>         mutex_lock(&mf_mutex);
>
>         if (PageHWPoison(page)) {
> -               pr_info("%s: %#lx page already poisoned\n", __func__, pfn);
> +               pr_info("%#lx: page already poisoned\n", pfn);
>                 put_ref_page(pfn, flags);
>                 mutex_unlock(&mf_mutex);
>                 return 0;
> --
> 2.45.2.803.g4e1b14247a-goog
>
diff mbox series

Patch

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 2cf7acc286de..685ab9a77966 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -2640,6 +2640,9 @@  int unpoison_memory(unsigned long pfn)
 }
 EXPORT_SYMBOL(unpoison_memory);
 
+#undef pr_fmt
+#define pr_fmt(fmt) "Soft offline: " fmt
+
 static bool mf_isolate_folio(struct folio *folio, struct list_head *pagelist)
 {
 	bool isolated = false;
@@ -2695,7 +2698,7 @@  static int soft_offline_in_use_page(struct page *page)
 
 	if (!huge && folio_test_large(folio)) {
 		if (try_to_split_thp_page(page, true)) {
-			pr_info("soft offline: %#lx: thp split failed\n", pfn);
+			pr_info("%#lx: thp split failed\n", pfn);
 			return -EBUSY;
 		}
 		folio = page_folio(page);
@@ -2707,7 +2710,7 @@  static int soft_offline_in_use_page(struct page *page)
 	if (PageHWPoison(page)) {
 		folio_unlock(folio);
 		folio_put(folio);
-		pr_info("soft offline: %#lx page already poisoned\n", pfn);
+		pr_info("%#lx: page already poisoned\n", pfn);
 		return 0;
 	}
 
@@ -2720,7 +2723,7 @@  static int soft_offline_in_use_page(struct page *page)
 	folio_unlock(folio);
 
 	if (ret) {
-		pr_info("soft_offline: %#lx: invalidated\n", pfn);
+		pr_info("%#lx: invalidated\n", pfn);
 		page_handle_poison(page, false, true);
 		return 0;
 	}
@@ -2737,13 +2740,13 @@  static int soft_offline_in_use_page(struct page *page)
 			if (!list_empty(&pagelist))
 				putback_movable_pages(&pagelist);
 
-			pr_info("soft offline: %#lx: %s migration failed %ld, type %pGp\n",
+			pr_info("%#lx: %s migration failed %ld, type %pGp\n",
 				pfn, msg_page[huge], ret, &page->flags);
 			if (ret > 0)
 				ret = -EBUSY;
 		}
 	} else {
-		pr_info("soft offline: %#lx: %s isolation failed, page count %d, type %pGp\n",
+		pr_info("%#lx: %s isolation failed, page count %d, type %pGp\n",
 			pfn, msg_page[huge], page_count(page), &page->flags);
 		ret = -EBUSY;
 	}
@@ -2795,7 +2798,7 @@  int soft_offline_page(unsigned long pfn, int flags)
 	mutex_lock(&mf_mutex);
 
 	if (PageHWPoison(page)) {
-		pr_info("%s: %#lx page already poisoned\n", __func__, pfn);
+		pr_info("%#lx: page already poisoned\n", pfn);
 		put_ref_page(pfn, flags);
 		mutex_unlock(&mf_mutex);
 		return 0;