linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] mm,hwpoison: Differentiate Action Required error in current and non  current processes
@ 2021-01-20  6:15 Aili Yao
  2021-01-20  6:37 ` HORIGUCHI NAOYA(堀口 直也)
  0 siblings, 1 reply; 3+ messages in thread
From: Aili Yao @ 2021-01-20  6:15 UTC (permalink / raw)
  To: naoya.horiguchi, linux-mm, osalvador, YANGFENG1

When a memory uncorrected error is triggered by process A who accessed
the address with error; It's Action Required Case for only current
process which triggered this.this Action Required case means Action
optional to other process who share the same page. Usually, kill current
process will be sufficient, other process sharing the same page will
get be signaled when they really touch the poisoned page.

But there is another scenario that other processes
sharing the same page want to be signaled early with PF_MCE_EARLY set,
In this case, we should get them into kill list and signal
BUS_MCEERR_AO to them.

So in this patch, task_early_kill will check current process if
force_early is set, and if not current,check find_early_kill_thread
to see if there is PF_MCE_EARLY process which cares the error.

In kill_proc, BUS_MCEERR_AR is only send to current, other process in
kill list will be signaled BUS_MCEERR_AO.

Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Aili Yao <yaoaili@kingsoft.com>
---
 mm/memory-failure.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 5a38e9eade94..2d6047780466 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -243,9 +243,12 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 			pfn, t->comm, t->pid);
 
 	if (flags & MF_ACTION_REQUIRED) {
-		WARN_ON_ONCE(t != current);
-		ret = force_sig_mceerr(BUS_MCEERR_AR,
+		if (tk->tsk == current)
+			ret = force_sig_mceerr(BUS_MCEERR_AR,
 					 (void __user *)tk->addr, addr_lsb);
+		else
+			ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)tk->addr,
+				addr_lsb, t);
 	} else {
 		/*
 		 * Don't use force here, it's convenient if the signal
@@ -454,11 +457,12 @@ static struct task_struct *task_early_kill(struct task_struct *tsk,
 		/*
 		 * Comparing ->mm here because current task might represent
 		 * a subthread, while tsk always points to the main thread.
+		 * If tsk is not current, we need to fallback to
+		 * find_early_kill_thread checking whether other processes with
+		 * PF_MCE_EARLY set still care the error.
 		 */
 		if (tsk->mm == current->mm)
 			return current;
-		else
-			return NULL;
 	}
 	return find_early_kill_thread(tsk);
 }
-- 
2.25.1


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

end of thread, other threads:[~2021-01-20  7:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20  6:15 [PATCH v3] mm,hwpoison: Differentiate Action Required error in current and non current processes Aili Yao
2021-01-20  6:37 ` HORIGUCHI NAOYA(堀口 直也)
2021-01-20  7:07   ` Aili Yao

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