Skip to content

Commit 3be306c

Browse files
Kyle Meyerakpm00
authored andcommitted
mm/memory-failure: fix redundant updates for already poisoned pages
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. Link: https://lkml.kernel.org/r/[email protected] Fixes: b8b9488 ("mm/memory-failure: improve memory failure action_result messages") Signed-off-by: Kyle Meyer <[email protected]> Reviewed-by: Jiaqi Yan <[email protected]> Acked-by: David Hildenbrand <[email protected]> Reviewed-by: Jane Chu <[email protected]> Acked-by: Miaohe Lin <[email protected]> Cc: Borislav Betkov <[email protected]> Cc: Kyle Meyer <[email protected]> Cc: Liam Howlett <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: "Luck, Tony" <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: Oscar Salvador <[email protected]> Cc: Russ Anderson <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent e67f0bd commit 3be306c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

mm/memory-failure.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ static const char * const action_page_types[] = {
956956
[MF_MSG_BUDDY] = "free buddy page",
957957
[MF_MSG_DAX] = "dax page",
958958
[MF_MSG_UNSPLIT_THP] = "unsplit thp",
959-
[MF_MSG_ALREADY_POISONED] = "already poisoned",
959+
[MF_MSG_ALREADY_POISONED] = "already poisoned page",
960960
[MF_MSG_UNKNOWN] = "unknown page",
961961
};
962962

@@ -1349,9 +1349,10 @@ static int action_result(unsigned long pfn, enum mf_action_page_type type,
13491349
{
13501350
trace_memory_failure_event(pfn, type, result);
13511351

1352-
num_poisoned_pages_inc(pfn);
1353-
1354-
update_per_node_mf_stats(pfn, result);
1352+
if (type != MF_MSG_ALREADY_POISONED) {
1353+
num_poisoned_pages_inc(pfn);
1354+
update_per_node_mf_stats(pfn, result);
1355+
}
13551356

13561357
pr_err("%#lx: recovery action for %s: %s\n",
13571358
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
20942095
*hugetlb = 0;
20952096
return 0;
20962097
} else if (res == -EHWPOISON) {
2097-
pr_err("%#lx: already hardware poisoned\n", pfn);
20982098
if (flags & MF_ACTION_REQUIRED) {
20992099
folio = page_folio(p);
21002100
res = kill_accessing_process(current, folio_pfn(folio), flags);
2101-
action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
21022101
}
2102+
action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
21032103
return res;
21042104
} else if (res == -EBUSY) {
21052105
if (!(flags & MF_NO_RETRY)) {
@@ -2285,7 +2285,6 @@ int memory_failure(unsigned long pfn, int flags)
22852285
goto unlock_mutex;
22862286

22872287
if (TestSetPageHWPoison(p)) {
2288-
pr_err("%#lx: already hardware poisoned\n", pfn);
22892288
res = -EHWPOISON;
22902289
if (flags & MF_ACTION_REQUIRED)
22912290
res = kill_accessing_process(current, pfn, flags);

0 commit comments

Comments
 (0)