Commit 1419b8752153d50f21cb34131cc613ee09662d8a

Authored by James Morse
Committed by Greg Kroah-Hartman
1 parent 0c0d3d8730

mm/memory-failure.c: use compound_head() flags for huge pages

commit 7258ae5c5a2ce2f5969e8b18b881be40ab55433d upstream.

memory_failure() chooses a recovery action function based on the page
flags.  For huge pages it uses the tail page flags which don't have
anything interesting set, resulting in:

> Memory failure: 0x9be3b4: Unknown page state
> Memory failure: 0x9be3b4: recovery action for unknown page: Failed

Instead, save a copy of the head page's flags if this is a huge page,
this means if there are no relevant flags for this tail page, we use the
head pages flags instead.  This results in the me_huge_page() recovery
action being called:

> Memory failure: 0x9b7969: recovery action for huge page: Delayed

For hugepages that have not yet been allocated, this allows the hugepage
to be dequeued.

Fixes: 524fca1e7356 ("HWPOISON: fix misjudgement of page_action() for errors on mlocked pages")
Link: http://lkml.kernel.org/r/20170524130204.21845-1-james.morse@arm.com
Signed-off-by: James Morse <james.morse@arm.com>
Tested-by: Punit Agrawal <punit.agrawal@arm.com>
Acked-by: Punit Agrawal <punit.agrawal@arm.com>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff

... ... @@ -1176,7 +1176,10 @@
1176 1176 * page_remove_rmap() in try_to_unmap_one(). So to determine page status
1177 1177 * correctly, we save a copy of the page flags at this time.
1178 1178 */
1179   - page_flags = p->flags;
  1179 + if (PageHuge(p))
  1180 + page_flags = hpage->flags;
  1181 + else
  1182 + page_flags = p->flags;
1180 1183  
1181 1184 /*
1182 1185 * unpoison always clear PG_hwpoison inside page lock