]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.48/mm-fix-the-null-mapping-case-in-__isolate_lru_page.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.48 / mm-fix-the-null-mapping-case-in-__isolate_lru_page.patch
1 From 145e1a71e090575c74969e3daa8136d1e5b99fc8 Mon Sep 17 00:00:00 2001
2 From: Hugh Dickins <hughd@google.com>
3 Date: Fri, 1 Jun 2018 16:50:50 -0700
4 Subject: mm: fix the NULL mapping case in __isolate_lru_page()
5
6 From: Hugh Dickins <hughd@google.com>
7
8 commit 145e1a71e090575c74969e3daa8136d1e5b99fc8 upstream.
9
10 George Boole would have noticed a slight error in 4.16 commit
11 69d763fc6d3a ("mm: pin address_space before dereferencing it while
12 isolating an LRU page"). Fix it, to match both the comment above it,
13 and the original behaviour.
14
15 Although anonymous pages are not marked PageDirty at first, we have an
16 old habit of calling SetPageDirty when a page is removed from swap
17 cache: so there's a category of ex-swap pages that are easily
18 migratable, but were inadvertently excluded from compaction's async
19 migration in 4.16.
20
21 Link: http://lkml.kernel.org/r/alpine.LSU.2.11.1805302014001.12558@eggly.anvils
22 Fixes: 69d763fc6d3a ("mm: pin address_space before dereferencing it while isolating an LRU page")
23 Signed-off-by: Hugh Dickins <hughd@google.com>
24 Acked-by: Minchan Kim <minchan@kernel.org>
25 Acked-by: Mel Gorman <mgorman@techsingularity.net>
26 Reported-by: Ivan Kalvachev <ikalvachev@gmail.com>
27 Cc: "Huang, Ying" <ying.huang@intel.com>
28 Cc: Jan Kara <jack@suse.cz>
29 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
30 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
31 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32
33 ---
34 mm/vmscan.c | 2 +-
35 1 file changed, 1 insertion(+), 1 deletion(-)
36
37 --- a/mm/vmscan.c
38 +++ b/mm/vmscan.c
39 @@ -1451,7 +1451,7 @@ int __isolate_lru_page(struct page *page
40 return ret;
41
42 mapping = page_mapping(page);
43 - migrate_dirty = mapping && mapping->a_ops->migratepage;
44 + migrate_dirty = !mapping || mapping->a_ops->migratepage;
45 unlock_page(page);
46 if (!migrate_dirty)
47 return ret;