* [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages
@ 2025-08-28 18:38 Kyle Meyer
2025-08-28 19:58 ` Jiaqi Yan
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kyle Meyer @ 2025-08-28 18:38 UTC (permalink / raw)
To: akpm, linmiaohe, jane.chu, jiaqiyan
Cc: bp, david, kyle.meyer, Liam.Howlett, linux-edac, linux-kernel,
linux-mm, lorenzo.stoakes, mhocko, nao.horiguchi, osalvador, rppt,
russ.anderson, surenb, tony.luck, vbabka
Duplicate memory errors can be reported by multiple sources.
Passing an already poisoned page to action_result() causes issues:
* The amount of hardware corrupted memory is incorrectly updated.
* Per NUMA node MF stats are incorrectly updated.
* Redundant "already poisoned" messages are printed.
Avoid those issues by:
* Skipping hardware corrupted memory updates for already poisoned pages.
* Skipping per NUMA node MF stats updates for already poisoned pages.
* Dropping redundant "already poisoned" messages.
Make MF_MSG_ALREADY_POISONED consistent with other action_page_types and
make calls to action_result() consistent for already poisoned
normal pages and huge pages.
Fixes: b8b9488d50b7 ("mm/memory-failure: improve memory failure action_result messages")
Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
---
v1 -> v2:
* Continue passing poisoned pages to action_result() with MF_FAILED but don't
update anything.
* https://lore.kernel.org/all/20250821164445.14467-1-kyle.meyer@hpe.com
---
mm/memory-failure.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index fc30ca4804bf..10b3c281c2ae 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -956,7 +956,7 @@ static const char * const action_page_types[] = {
[MF_MSG_BUDDY] = "free buddy page",
[MF_MSG_DAX] = "dax page",
[MF_MSG_UNSPLIT_THP] = "unsplit thp",
- [MF_MSG_ALREADY_POISONED] = "already poisoned",
+ [MF_MSG_ALREADY_POISONED] = "already poisoned page",
[MF_MSG_UNKNOWN] = "unknown page",
};
@@ -1349,9 +1349,10 @@ static int action_result(unsigned long pfn, enum mf_action_page_type type,
{
trace_memory_failure_event(pfn, type, result);
- num_poisoned_pages_inc(pfn);
-
- update_per_node_mf_stats(pfn, result);
+ if (type != MF_MSG_ALREADY_POISONED) {
+ num_poisoned_pages_inc(pfn);
+ update_per_node_mf_stats(pfn, result);
+ }
pr_err("%#lx: recovery action for %s: %s\n",
pfn, action_page_types[type], action_name[result]);
@@ -2094,12 +2095,11 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb
*hugetlb = 0;
return 0;
} else if (res == -EHWPOISON) {
- pr_err("%#lx: already hardware poisoned\n", pfn);
if (flags & MF_ACTION_REQUIRED) {
folio = page_folio(p);
res = kill_accessing_process(current, folio_pfn(folio), flags);
- action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
}
+ action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
return res;
} else if (res == -EBUSY) {
if (!(flags & MF_NO_RETRY)) {
@@ -2285,7 +2285,6 @@ int memory_failure(unsigned long pfn, int flags)
goto unlock_mutex;
if (TestSetPageHWPoison(p)) {
- pr_err("%#lx: already hardware poisoned\n", pfn);
res = -EHWPOISON;
if (flags & MF_ACTION_REQUIRED)
res = kill_accessing_process(current, pfn, flags);
--
2.50.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages
2025-08-28 18:38 [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages Kyle Meyer
@ 2025-08-28 19:58 ` Jiaqi Yan
2025-08-28 20:16 ` David Hildenbrand
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jiaqi Yan @ 2025-08-28 19:58 UTC (permalink / raw)
To: Kyle Meyer
Cc: akpm, linmiaohe, jane.chu, bp, david, Liam.Howlett, linux-edac,
linux-kernel, linux-mm, lorenzo.stoakes, mhocko, nao.horiguchi,
osalvador, rppt, russ.anderson, surenb, tony.luck, vbabka
On Thu, Aug 28, 2025 at 11:38 AM Kyle Meyer <kyle.meyer@hpe.com> wrote:
>
> Duplicate memory errors can be reported by multiple sources.
>
> Passing an already poisoned page to action_result() causes issues:
>
> * The amount of hardware corrupted memory is incorrectly updated.
> * Per NUMA node MF stats are incorrectly updated.
> * Redundant "already poisoned" messages are printed.
>
> Avoid those issues by:
>
> * Skipping hardware corrupted memory updates for already poisoned pages.
> * Skipping per NUMA node MF stats updates for already poisoned pages.
> * Dropping redundant "already poisoned" messages.
>
> Make MF_MSG_ALREADY_POISONED consistent with other action_page_types and
> make calls to action_result() consistent for already poisoned
> normal pages and huge pages.
>
> Fixes: b8b9488d50b7 ("mm/memory-failure: improve memory failure action_result messages")
> Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
> ---
>
> v1 -> v2:
> * Continue passing poisoned pages to action_result() with MF_FAILED but don't
> update anything.
> * https://lore.kernel.org/all/20250821164445.14467-1-kyle.meyer@hpe.com
>
> ---
> mm/memory-failure.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index fc30ca4804bf..10b3c281c2ae 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -956,7 +956,7 @@ static const char * const action_page_types[] = {
> [MF_MSG_BUDDY] = "free buddy page",
> [MF_MSG_DAX] = "dax page",
> [MF_MSG_UNSPLIT_THP] = "unsplit thp",
> - [MF_MSG_ALREADY_POISONED] = "already poisoned",
> + [MF_MSG_ALREADY_POISONED] = "already poisoned page",
> [MF_MSG_UNKNOWN] = "unknown page",
> };
>
> @@ -1349,9 +1349,10 @@ static int action_result(unsigned long pfn, enum mf_action_page_type type,
> {
> trace_memory_failure_event(pfn, type, result);
>
> - num_poisoned_pages_inc(pfn);
> -
> - update_per_node_mf_stats(pfn, result);
> + if (type != MF_MSG_ALREADY_POISONED) {
> + num_poisoned_pages_inc(pfn);
> + update_per_node_mf_stats(pfn, result);
> + }
Thanks Kyle, the code looks good to me. While you wait for Miaohe's
review/ack...
Reviewed-by: Jiaqi Yan <jiaqiyan@google.com>
>
> pr_err("%#lx: recovery action for %s: %s\n",
> pfn, action_page_types[type], action_name[result]);
> @@ -2094,12 +2095,11 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb
> *hugetlb = 0;
> return 0;
> } else if (res == -EHWPOISON) {
> - pr_err("%#lx: already hardware poisoned\n", pfn);
> if (flags & MF_ACTION_REQUIRED) {
> folio = page_folio(p);
> res = kill_accessing_process(current, folio_pfn(folio), flags);
> - action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
> }
> + action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
> return res;
> } else if (res == -EBUSY) {
> if (!(flags & MF_NO_RETRY)) {
> @@ -2285,7 +2285,6 @@ int memory_failure(unsigned long pfn, int flags)
> goto unlock_mutex;
>
> if (TestSetPageHWPoison(p)) {
> - pr_err("%#lx: already hardware poisoned\n", pfn);
> res = -EHWPOISON;
> if (flags & MF_ACTION_REQUIRED)
> res = kill_accessing_process(current, pfn, flags);
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages
2025-08-28 18:38 [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages Kyle Meyer
2025-08-28 19:58 ` Jiaqi Yan
@ 2025-08-28 20:16 ` David Hildenbrand
2025-08-28 22:53 ` jane.chu
2025-08-29 6:35 ` Miaohe Lin
3 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2025-08-28 20:16 UTC (permalink / raw)
To: Kyle Meyer, akpm, linmiaohe, jane.chu, jiaqiyan
Cc: bp, Liam.Howlett, linux-edac, linux-kernel, linux-mm,
lorenzo.stoakes, mhocko, nao.horiguchi, osalvador, rppt,
russ.anderson, surenb, tony.luck, vbabka
On 28.08.25 20:38, Kyle Meyer wrote:
> Duplicate memory errors can be reported by multiple sources.
>
> Passing an already poisoned page to action_result() causes issues:
>
> * The amount of hardware corrupted memory is incorrectly updated.
> * Per NUMA node MF stats are incorrectly updated.
> * Redundant "already poisoned" messages are printed.
>
> Avoid those issues by:
>
> * Skipping hardware corrupted memory updates for already poisoned pages.
> * Skipping per NUMA node MF stats updates for already poisoned pages.
> * Dropping redundant "already poisoned" messages.
>
> Make MF_MSG_ALREADY_POISONED consistent with other action_page_types and
> make calls to action_result() consistent for already poisoned
> normal pages and huge pages.
>
> Fixes: b8b9488d50b7 ("mm/memory-failure: improve memory failure action_result messages")
> Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
> ---
>
> v1 -> v2:
> * Continue passing poisoned pages to action_result() with MF_FAILED but don't
> update anything.
> * https://lore.kernel.org/all/20250821164445.14467-1-kyle.meyer@hpe.com
>
> ---
> mm/memory-failure.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index fc30ca4804bf..10b3c281c2ae 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -956,7 +956,7 @@ static const char * const action_page_types[] = {
> [MF_MSG_BUDDY] = "free buddy page",
> [MF_MSG_DAX] = "dax page",
> [MF_MSG_UNSPLIT_THP] = "unsplit thp",
> - [MF_MSG_ALREADY_POISONED] = "already poisoned",
> + [MF_MSG_ALREADY_POISONED] = "already poisoned page",
> [MF_MSG_UNKNOWN] = "unknown page",
> };
>
> @@ -1349,9 +1349,10 @@ static int action_result(unsigned long pfn, enum mf_action_page_type type,
> {
> trace_memory_failure_event(pfn, type, result);
>
> - num_poisoned_pages_inc(pfn);
> -
> - update_per_node_mf_stats(pfn, result);
> + if (type != MF_MSG_ALREADY_POISONED) {
> + num_poisoned_pages_inc(pfn);
> + update_per_node_mf_stats(pfn, result);
> + }
>
> pr_err("%#lx: recovery action for %s: %s\n",
> pfn, action_page_types[type], action_name[result]);
> @@ -2094,12 +2095,11 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb
> *hugetlb = 0;
> return 0;
> } else if (res == -EHWPOISON) {
> - pr_err("%#lx: already hardware poisoned\n", pfn);
> if (flags & MF_ACTION_REQUIRED) {
> folio = page_folio(p);
> res = kill_accessing_process(current, folio_pfn(folio), flags);
> - action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
> }
> + action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
Was briefly confused by that change, but action_result() now essentially
only traces + pr_err() with MF_MSG_ALREADY_POISONED.
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers
David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages
2025-08-28 18:38 [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages Kyle Meyer
2025-08-28 19:58 ` Jiaqi Yan
2025-08-28 20:16 ` David Hildenbrand
@ 2025-08-28 22:53 ` jane.chu
2025-08-29 6:35 ` Miaohe Lin
3 siblings, 0 replies; 5+ messages in thread
From: jane.chu @ 2025-08-28 22:53 UTC (permalink / raw)
To: Kyle Meyer, akpm, linmiaohe, jiaqiyan
Cc: bp, david, Liam.Howlett, linux-edac, linux-kernel, linux-mm,
lorenzo.stoakes, mhocko, nao.horiguchi, osalvador, rppt,
russ.anderson, surenb, tony.luck, vbabka
On 8/28/2025 11:38 AM, Kyle Meyer wrote:
> Duplicate memory errors can be reported by multiple sources.
>
> Passing an already poisoned page to action_result() causes issues:
>
> * The amount of hardware corrupted memory is incorrectly updated.
> * Per NUMA node MF stats are incorrectly updated.
> * Redundant "already poisoned" messages are printed.
>
> Avoid those issues by:
>
> * Skipping hardware corrupted memory updates for already poisoned pages.
> * Skipping per NUMA node MF stats updates for already poisoned pages.
> * Dropping redundant "already poisoned" messages.
>
> Make MF_MSG_ALREADY_POISONED consistent with other action_page_types and
> make calls to action_result() consistent for already poisoned
> normal pages and huge pages.
>
> Fixes: b8b9488d50b7 ("mm/memory-failure: improve memory failure action_result messages")
> Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
> ---
>
> v1 -> v2:
> * Continue passing poisoned pages to action_result() with MF_FAILED but don't
> update anything.
> * https://lore.kernel.org/all/20250821164445.14467-1-kyle.meyer@hpe.com
>
> ---
> mm/memory-failure.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index fc30ca4804bf..10b3c281c2ae 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -956,7 +956,7 @@ static const char * const action_page_types[] = {
> [MF_MSG_BUDDY] = "free buddy page",
> [MF_MSG_DAX] = "dax page",
> [MF_MSG_UNSPLIT_THP] = "unsplit thp",
> - [MF_MSG_ALREADY_POISONED] = "already poisoned",
> + [MF_MSG_ALREADY_POISONED] = "already poisoned page",
> [MF_MSG_UNKNOWN] = "unknown page",
> };
>
> @@ -1349,9 +1349,10 @@ static int action_result(unsigned long pfn, enum mf_action_page_type type,
> {
> trace_memory_failure_event(pfn, type, result);
>
> - num_poisoned_pages_inc(pfn);
> -
> - update_per_node_mf_stats(pfn, result);
> + if (type != MF_MSG_ALREADY_POISONED) {
> + num_poisoned_pages_inc(pfn);
> + update_per_node_mf_stats(pfn, result);
> + }
>
> pr_err("%#lx: recovery action for %s: %s\n",
> pfn, action_page_types[type], action_name[result]);
> @@ -2094,12 +2095,11 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb
> *hugetlb = 0;
> return 0;
> } else if (res == -EHWPOISON) {
> - pr_err("%#lx: already hardware poisoned\n", pfn);
> if (flags & MF_ACTION_REQUIRED) {
> folio = page_folio(p);
> res = kill_accessing_process(current, folio_pfn(folio), flags);
> - action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
> }
> + action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
> return res;
> } else if (res == -EBUSY) {
> if (!(flags & MF_NO_RETRY)) {
> @@ -2285,7 +2285,6 @@ int memory_failure(unsigned long pfn, int flags)
> goto unlock_mutex;
>
> if (TestSetPageHWPoison(p)) {
> - pr_err("%#lx: already hardware poisoned\n", pfn);
> res = -EHWPOISON;
> if (flags & MF_ACTION_REQUIRED)
> res = kill_accessing_process(current, pfn, flags);
Looks good, thanks!
Reviewed-by: Jane Chu <jane.chu@oracle.com>
-jane
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages
2025-08-28 18:38 [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages Kyle Meyer
` (2 preceding siblings ...)
2025-08-28 22:53 ` jane.chu
@ 2025-08-29 6:35 ` Miaohe Lin
3 siblings, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2025-08-29 6:35 UTC (permalink / raw)
To: Kyle Meyer
Cc: bp, david, Liam.Howlett, linux-edac, linux-kernel, linux-mm,
lorenzo.stoakes, mhocko, nao.horiguchi, osalvador, rppt,
russ.anderson, surenb, tony.luck, vbabka, akpm, jane.chu,
jiaqiyan
On 2025/8/29 2:38, Kyle Meyer wrote:
> Duplicate memory errors can be reported by multiple sources.
>
> Passing an already poisoned page to action_result() causes issues:
>
> * The amount of hardware corrupted memory is incorrectly updated.
> * Per NUMA node MF stats are incorrectly updated.
> * Redundant "already poisoned" messages are printed.
>
> Avoid those issues by:
>
> * Skipping hardware corrupted memory updates for already poisoned pages.
> * Skipping per NUMA node MF stats updates for already poisoned pages.
> * Dropping redundant "already poisoned" messages.
>
> Make MF_MSG_ALREADY_POISONED consistent with other action_page_types and
> make calls to action_result() consistent for already poisoned
> normal pages and huge pages.
>
> Fixes: b8b9488d50b7 ("mm/memory-failure: improve memory failure action_result messages")
> Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
Thanks for your patch. This patch looks good to me.
Acked-by: Miaohe Lin <linmiaohe@huawei.com>
Thanks.
.
> ---
>
> v1 -> v2:
> * Continue passing poisoned pages to action_result() with MF_FAILED but don't
> update anything.
> * https://lore.kernel.org/all/20250821164445.14467-1-kyle.meyer@hpe.com
>
> ---
> mm/memory-failure.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index fc30ca4804bf..10b3c281c2ae 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -956,7 +956,7 @@ static const char * const action_page_types[] = {
> [MF_MSG_BUDDY] = "free buddy page",
> [MF_MSG_DAX] = "dax page",
> [MF_MSG_UNSPLIT_THP] = "unsplit thp",
> - [MF_MSG_ALREADY_POISONED] = "already poisoned",
> + [MF_MSG_ALREADY_POISONED] = "already poisoned page",
> [MF_MSG_UNKNOWN] = "unknown page",
> };
>
> @@ -1349,9 +1349,10 @@ static int action_result(unsigned long pfn, enum mf_action_page_type type,
> {
> trace_memory_failure_event(pfn, type, result);
>
> - num_poisoned_pages_inc(pfn);
> -
> - update_per_node_mf_stats(pfn, result);
> + if (type != MF_MSG_ALREADY_POISONED) {
> + num_poisoned_pages_inc(pfn);
> + update_per_node_mf_stats(pfn, result);
> + }
>
> pr_err("%#lx: recovery action for %s: %s\n",
> pfn, action_page_types[type], action_name[result]);
> @@ -2094,12 +2095,11 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb
> *hugetlb = 0;
> return 0;
> } else if (res == -EHWPOISON) {
> - pr_err("%#lx: already hardware poisoned\n", pfn);
> if (flags & MF_ACTION_REQUIRED) {
> folio = page_folio(p);
> res = kill_accessing_process(current, folio_pfn(folio), flags);
> - action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
> }
> + action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
> return res;
> } else if (res == -EBUSY) {
> if (!(flags & MF_NO_RETRY)) {
> @@ -2285,7 +2285,6 @@ int memory_failure(unsigned long pfn, int flags)
> goto unlock_mutex;
>
> if (TestSetPageHWPoison(p)) {
> - pr_err("%#lx: already hardware poisoned\n", pfn);
> res = -EHWPOISON;
> if (flags & MF_ACTION_REQUIRED)
> res = kill_accessing_process(current, pfn, flags);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-29 6:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28 18:38 [PATCH v2] mm/memory-failure: Fix redundant updates for already poisoned pages Kyle Meyer
2025-08-28 19:58 ` Jiaqi Yan
2025-08-28 20:16 ` David Hildenbrand
2025-08-28 22:53 ` jane.chu
2025-08-29 6:35 ` Miaohe Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).