Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1185291 > unrolled thread

[PATCH v1 3/4] mm/memory-failure: give up error handling for non-tail-refcounted thp

Started byNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
First post2015-07-16 03:50 +0200
Last post2015-07-16 04:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v1 3/4] mm/memory-failure: give up error handling for  non-tail-refcounted thp Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-07-16 03:50 +0200
    Re: [PATCH v1 3/4] mm/memory-failure: give up error handling for  non-tail-refcounted thp Andi Kleen <andi@firstfloor.org> - 2015-07-16 04:40 +0200
      Re: [PATCH v1 3/4] mm/memory-failure: give up error handling for  non-tail-refcounted thp Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-07-16 04:50 +0200

#1185291 — [PATCH v1 3/4] mm/memory-failure: give up error handling for non-tail-refcounted thp

FromNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date2015-07-16 03:50 +0200
Subject[PATCH v1 3/4] mm/memory-failure: give up error handling for non-tail-refcounted thp
Message-ID<pMGtc-pn-31@gated-at.bofh.it>
"non anonymous thp" case is still racy with freeing thp, which causes panic
due to put_page() for refcount-0 page. It seems that closing up this race
might be hard (and/or not worth doing,) so let's give up the error handling
for this case.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
 mm/memory-failure.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git v4.2-rc2.orig/mm/memory-failure.c v4.2-rc2/mm/memory-failure.c
index f72d2fad0b90..421d7c9b30f4 100644
--- v4.2-rc2.orig/mm/memory-failure.c
+++ v4.2-rc2/mm/memory-failure.c
@@ -909,6 +909,15 @@ int get_hwpoison_page(struct page *page)
 	 * directly for tail pages.
 	 */
 	if (PageTransHuge(head)) {
+		/*
+		 * Non anonymous thp exists only in allocation/free time. We
+		 * can't handle such a case correctly, so let's give it up.
+		 * This should be better than triggering BUG_ON when kernel
+		 * tries to touch a "partially handled" page.
+		 */
+		if (!PageAnon(head))
+			return 0;
+
 		if (get_page_unless_zero(head)) {
 			if (PageTail(page))
 				get_page(page);
@@ -1134,15 +1143,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
 	}
 
 	if (!PageHuge(p) && PageTransHuge(hpage)) {
-		if (!PageAnon(hpage)) {
-			pr_err("MCE: %#lx: non anonymous thp\n", pfn);
-			if (TestClearPageHWPoison(p))
-				atomic_long_sub(nr_pages, &num_poisoned_pages);
-			put_page(p);
-			if (p != hpage)
-				put_page(hpage);
-			return -EBUSY;
-		}
 		if (unlikely(split_huge_page(hpage))) {
 			pr_err("MCE: %#lx: thp split failed\n", pfn);
 			if (TestClearPageHWPoison(p))
-- 
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1185446

FromAndi Kleen <andi@firstfloor.org>
Date2015-07-16 04:40 +0200
Message-ID<pMHfz-1FU-1@gated-at.bofh.it>
In reply to#1185291
> @@ -909,6 +909,15 @@ int get_hwpoison_page(struct page *page)
>  	 * directly for tail pages.
>  	 */
>  	if (PageTransHuge(head)) {
> +		/*
> +		 * Non anonymous thp exists only in allocation/free time. We
> +		 * can't handle such a case correctly, so let's give it up.
> +		 * This should be better than triggering BUG_ON when kernel
> +		 * tries to touch a "partially handled" page.
> +		 */
> +		if (!PageAnon(head))
> +			return 0;

Please print a message for this case. In the future there will be
likely more non anonymous THP pages from Kirill's large page cache work
(so eventually we'll need it)

-Andi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1185452

FromNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date2015-07-16 04:50 +0200
Message-ID<pMHpf-1R5-9@gated-at.bofh.it>
In reply to#1185446
On Thu, Jul 16, 2015 at 04:33:07AM +0200, Andi Kleen wrote:
> > @@ -909,6 +909,15 @@ int get_hwpoison_page(struct page *page)
> >  	 * directly for tail pages.
> >  	 */
> >  	if (PageTransHuge(head)) {
> > +		/*
> > +		 * Non anonymous thp exists only in allocation/free time. We
> > +		 * can't handle such a case correctly, so let's give it up.
> > +		 * This should be better than triggering BUG_ON when kernel
> > +		 * tries to touch a "partially handled" page.
> > +		 */
> > +		if (!PageAnon(head))
> > +			return 0;
> 
> Please print a message for this case. In the future there will be
> likely more non anonymous THP pages from Kirill's large page cache work
> (so eventually we'll need it)

OK, I'll do this.

Thanks,
Naoya Horiguchi--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web