* [PATCH] mm: memory-failure: update statistics before emitting the trace event
@ 2026-10-28 8:09 Mauro Carvalho Chehab
2026-11-02 3:40 ` Miaohe Lin
0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2026-10-28 8:09 UTC (permalink / raw)
To: Miaohe Lin
Cc: Mauro Carvalho Chehab, linux-kernel, linux-mm, Andrew Morton,
Naoya Horiguchi, zhenwei pi, Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <m.chehab@huawei.com>
Today's rasdaemon-ci run showed a race condition at the page poison
logic affecting userspace (rasdaemon): action_result() emits a
memory_failure_event before incrementing num_poisoned_pages and
updating the per-node memory failure statistics.
That causes userspace to read /proc/meminfo to detect HardwareCorrupted
trace events to warn if the value exceeds POISON_STAT_THRESHOLD.
This works most of the cases, but there is a chance that the value
not being updated in time before libtraceevent notification is handled.
Root cause is commit e240ac52f7da ("mm/memory-failure.c: simplify num_poisoned_pages_inc/dec")
which changed the order of updates.
Rasdaemod-ci run up to Oct 27 worked properly, but on today's run, it
failed to get the HardwareCorrupted data from /proc/meminfo because
it was updated only after trigging the hardware error event:
https://mchehab.github.io/rasdaemon-ci/failures/20261028T035110Z-40629018388/daily/aarch64/consumer-poison-page-stat.html
E.g. it failed to log this:
rasdaemon: Poison page statistics exceeded threshold: 4 kB (threshold: 0 kB)
This is important for rasdaemon, as the consumer's action monitors a failed
threshold before poisoning pages. So, if the counter doesn't update properly,
it will end not poisoning pages at the expected threshold.
Fixes: e240ac52f7da ("mm/memory-failure.c: simplify num_poisoned_pages_inc/dec")
Closes: https://github.com/mchehab/rasdaemon-ci/actions/runs/40629018388
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
mm/memory-failure.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index a8b03e2920ba..eba6fe1dfdea 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1281,13 +1281,13 @@ static bool panic_on_unrecoverable_mf(enum mf_action_page_type type,
static int action_result(unsigned long pfn, enum mf_action_page_type type,
enum mf_result result)
{
- trace_memory_failure_event(pfn, type, result);
-
if (type != MF_MSG_ALREADY_POISONED && type != MF_MSG_PFN_MAP) {
num_poisoned_pages_inc(pfn);
update_per_node_mf_stats(pfn, result);
}
+ trace_memory_failure_event(pfn, type, result);
+
pr_err("%#lx: recovery action for %s: %s\n",
pfn, action_page_types[type], action_name[result]);
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm: memory-failure: update statistics before emitting the trace event
2026-10-28 8:09 [PATCH] mm: memory-failure: update statistics before emitting the trace event Mauro Carvalho Chehab
@ 2026-11-02 3:40 ` Miaohe Lin
0 siblings, 0 replies; 2+ messages in thread
From: Miaohe Lin @ 2026-11-02 3:40 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Mauro Carvalho Chehab, linux-kernel, linux-mm, Andrew Morton,
Naoya Horiguchi, zhenwei pi
On 2026/10/28 16:09, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <m.chehab@huawei.com>
>
> Today's rasdaemon-ci run showed a race condition at the page poison
> logic affecting userspace (rasdaemon): action_result() emits a
> memory_failure_event before incrementing num_poisoned_pages and
> updating the per-node memory failure statistics.
>
> That causes userspace to read /proc/meminfo to detect HardwareCorrupted
> trace events to warn if the value exceeds POISON_STAT_THRESHOLD.
> This works most of the cases, but there is a chance that the value
> not being updated in time before libtraceevent notification is handled.
>
> Root cause is commit e240ac52f7da ("mm/memory-failure.c: simplify num_poisoned_pages_inc/dec")
> which changed the order of updates.
>
> Rasdaemod-ci run up to Oct 27 worked properly, but on today's run, it
> failed to get the HardwareCorrupted data from /proc/meminfo because
> it was updated only after trigging the hardware error event:
> https://mchehab.github.io/rasdaemon-ci/failures/20261028T035110Z-40629018388/daily/aarch64/consumer-poison-page-stat.html
>
> E.g. it failed to log this:
> rasdaemon: Poison page statistics exceeded threshold: 4 kB (threshold: 0 kB)
>
> This is important for rasdaemon, as the consumer's action monitors a failed
> threshold before poisoning pages. So, if the counter doesn't update properly,
> it will end not poisoning pages at the expected threshold.
>
> Fixes: e240ac52f7da ("mm/memory-failure.c: simplify num_poisoned_pages_inc/dec")
> Closes: https://github.com/mchehab/rasdaemon-ci/actions/runs/40629018388
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Miaohe Lin <linmiaohe@huawei.com>
Thanks.
.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-02 3:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 8:09 [PATCH] mm: memory-failure: update statistics before emitting the trace event Mauro Carvalho Chehab
2026-11-02 3:40 ` Miaohe Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®