* [PATCH] mm/hwpoison: dissolve error hugepages of file mapping
@ 2021-07-15 15:08 Bin Wang
2021-07-15 15:22 ` Matthew Wilcox
0 siblings, 1 reply; 3+ messages in thread
From: Bin Wang @ 2021-07-15 15:08 UTC (permalink / raw)
To: linux-mm; +Cc: naoya.horiguchi, akpm, wuxu.wu, linux-kernel
We handle error on hugetlb file with hugetlbfs_error_remove_page(),
which removes the error hugepages from page cache. And with the
HWPoison flag in head page, it is safe to free the error hugepages
and dissolve it.
Fixes: 78bb920344b8a ("mm: hwpoison: dissolve in-use hugepage in unrecoverable memory error")
Signed-off-by: Bin Wang <wangbin224@huawei.com>
---
mm/memory-failure.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index eefd823deb67..6a3c46b601ef 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -988,6 +988,13 @@ static int me_huge_page(struct page *p, unsigned long pfn)
if (mapping) {
res = truncate_error_page(hpage, pfn, mapping);
unlock_page(hpage);
+ if (ret == MF_RECOVERED) {
+ put_page(hpage);
+ if (__page_handle_poison(p))
+ page_ref_inc(p);
+ else
+ ret = MF_FAILED;
+ }
} else {
res = MF_FAILED;
unlock_page(hpage);
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/hwpoison: dissolve error hugepages of file mapping
2021-07-15 15:08 [PATCH] mm/hwpoison: dissolve error hugepages of file mapping Bin Wang
@ 2021-07-15 15:22 ` Matthew Wilcox
2021-07-16 1:00 ` Bin Wang
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2021-07-15 15:22 UTC (permalink / raw)
To: Bin Wang; +Cc: linux-mm, naoya.horiguchi, akpm, wuxu.wu, linux-kernel
On Thu, Jul 15, 2021 at 11:08:52PM +0800, Bin Wang wrote:
> We handle error on hugetlb file with hugetlbfs_error_remove_page(),
> which removes the error hugepages from page cache. And with the
> HWPoison flag in head page, it is safe to free the error hugepages
> and dissolve it.
How is that safe? If you're going to dissolve the huge page, you
need to figure out which subpage needs to have the HWPoison flag set.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH] mm/hwpoison: dissolve error hugepages of file mapping
2021-07-15 15:22 ` Matthew Wilcox
@ 2021-07-16 1:00 ` Bin Wang
0 siblings, 0 replies; 3+ messages in thread
From: Bin Wang @ 2021-07-16 1:00 UTC (permalink / raw)
To: willy; +Cc: akpm, linux-kernel, linux-mm, naoya.horiguchi, wangbin224, wuxu.wu
Hi Matthew,
On Thu, 15 Jul 2021 at 16:22:40 +0100, Matthew Wilcox wrote:
> How is that safe? If you're going to dissolve the huge page, you
> need to figure out which subpage needs to have the HWPoison flag set.
Thanks for your review. The p that we pass to the __page_handle_poison()
is the error subpage. And we will move the HWPoison flag to subpage in
the dissolve_free_huge_page():
if (PageHWPoison(head) && page != head) {
SetPageHWPoison(page);
ClearPageHWPoison(head);
}
Thanks,
Bin Wang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-16 1:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15 15:08 [PATCH] mm/hwpoison: dissolve error hugepages of file mapping Bin Wang
2021-07-15 15:22 ` Matthew Wilcox
2021-07-16 1:00 ` Bin Wang
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).