]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.19.2/mm-hwpoison-drop-lru_add_drain_all-in-__soft_offline_page.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.19.2 / mm-hwpoison-drop-lru_add_drain_all-in-__soft_offline_page.patch
CommitLineData
13a0632a
GKH
1From 9ab3b598d2dfbdb0153ffa7e4b1456bbff59a25d Mon Sep 17 00:00:00 2001
2From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
3Date: Thu, 12 Feb 2015 15:00:25 -0800
4Subject: mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page()
5
6From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
7
8commit 9ab3b598d2dfbdb0153ffa7e4b1456bbff59a25d upstream.
9
10A race condition starts to be visible in recent mmotm, where a PG_hwpoison
11flag is set on a migration source page *before* it's back in buddy page
12poo= l.
13
14This is problematic because no page flag is supposed to be set when
15freeing (see __free_one_page().) So the user-visible effect of this race
16is that it could trigger the BUG_ON() when soft-offlining is called.
17
18The root cause is that we call lru_add_drain_all() to make sure that the
19page is in buddy, but that doesn't work because this function just
20schedule= s a work item and doesn't wait its completion.
21drain_all_pages() does drainin= g directly, so simply dropping
22lru_add_drain_all() solves this problem.
23
24Fixes: f15bdfa802bf ("mm/memory-failure.c: fix memory leak in successful soft offlining")
25Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
26Cc: Andi Kleen <andi@firstfloor.org>
27Cc: Tony Luck <tony.luck@intel.com>
28Cc: Chen Gong <gong.chen@linux.intel.com>
29Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
30Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
31Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32
33---
34 mm/memory-failure.c | 2 --
35 1 file changed, 2 deletions(-)
36
37--- a/mm/memory-failure.c
38+++ b/mm/memory-failure.c
39@@ -1654,8 +1654,6 @@ static int __soft_offline_page(struct pa
40 * setting PG_hwpoison.
41 */
42 if (!is_free_buddy_page(page))
43- lru_add_drain_all();
44- if (!is_free_buddy_page(page))
45 drain_all_pages(page_zone(page));
46 SetPageHWPoison(page);
47 if (!is_free_buddy_page(page))