+ mm-madvise-ensure-poisoned-pages-are-removed-from-per-cpu-lists.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm, madvise: ensure poisoned pages are removed from per-cpu lists
has been added to the -mm tree.  Its filename is
     mm-madvise-ensure-poisoned-pages-are-removed-from-per-cpu-lists.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-madvise-ensure-poisoned-pages-are-removed-from-per-cpu-lists.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-madvise-ensure-poisoned-pages-are-removed-from-per-cpu-lists.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
Subject: mm, madvise: ensure poisoned pages are removed from per-cpu lists

Wendy Wang reported off-list that a RAS HWPOISON-SOFT test case failed and
bisected it to the commit 479f854a207c ("mm, page_alloc: defer debugging
checks of pages allocated from the PCP").  The problem is that a page that
was poisoned with madvise() is reused.  The commit removed a check that
would trigger if DEBUG_VM was enabled but re-enabling the check only fixes
the problem as a side-effect by printing a bad_page warning and
recovering.

The root of the problem is that an madvise() can leave a poisoned page on
the per-cpu list.  This patch drains all per-cpu lists after pages are
poisoned so that they will not be reused.  Wendy reports that the test
case in question passes with this patch applied.  While this could be done
in a targeted fashion, it is over-complicated for such a rare operation.

Link: http://lkml.kernel.org/r/20170828133414.7qro57jbepdcyz5x@xxxxxxxxxxxxxxxxxxx
Fixes: 479f854a207c ("mm, page_alloc: defer debugging checks of pages allocated from the PCP")
Signed-off-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
Reported-by: Wang, Wendy <wendy.wang@xxxxxxxxx>
Tested-by: Wang, Wendy <wendy.wang@xxxxxxxxx>
Acked-by: David Rientjes <rientjes@xxxxxxxxxx>
Cc: "Hansen, Dave" <dave.hansen@xxxxxxxxx>
Cc: "Luck, Tony" <tony.luck@xxxxxxxxx>
Cc: Naoya Horiguchi <nao.horiguchi@xxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/madvise.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff -puN mm/madvise.c~mm-madvise-ensure-poisoned-pages-are-removed-from-per-cpu-lists mm/madvise.c
--- a/mm/madvise.c~mm-madvise-ensure-poisoned-pages-are-removed-from-per-cpu-lists
+++ a/mm/madvise.c
@@ -613,6 +613,7 @@ static int madvise_inject_error(int beha
 		unsigned long start, unsigned long end)
 {
 	struct page *page;
+	struct zone *zone;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -646,6 +647,11 @@ static int madvise_inject_error(int beha
 		if (ret)
 			return ret;
 	}
+
+	/* Ensure that all poisoned pages are removed from per-cpu lists */
+	for_each_populated_zone(zone)
+		drain_all_pages(zone);
+
 	return 0;
 }
 #endif
_

Patches currently in -mm which might be from mgorman@xxxxxxxxxxxxxxxxxxx are

mm-madvise-ensure-poisoned-pages-are-removed-from-per-cpu-lists.patch
mm-always-flush-vma-ranges-affected-by-zap_page_range-v2.patch




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]