]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.19.2/mm-fix-negative-nr_isolated-counts.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.19.2 / mm-fix-negative-nr_isolated-counts.patch
1 From ff59909a077b3c51c168cb658601c6b63136a347 Mon Sep 17 00:00:00 2001
2 From: Hugh Dickins <hughd@google.com>
3 Date: Thu, 12 Feb 2015 15:00:28 -0800
4 Subject: mm: fix negative nr_isolated counts
5
6 From: Hugh Dickins <hughd@google.com>
7
8 commit ff59909a077b3c51c168cb658601c6b63136a347 upstream.
9
10 The vmstat interfaces are good at hiding negative counts (at least when
11 CONFIG_SMP); but if you peer behind the curtain, you find that
12 nr_isolated_anon and nr_isolated_file soon go negative, and grow ever
13 more negative: so they can absorb larger and larger numbers of isolated
14 pages, yet still appear to be zero.
15
16 I'm happy to avoid a congestion_wait() when too_many_isolated() myself;
17 but I guess it's there for a good reason, in which case we ought to get
18 too_many_isolated() working again.
19
20 The imbalance comes from isolate_migratepages()'s ISOLATE_ABORT case:
21 putback_movable_pages() decrements the NR_ISOLATED counts, but we forgot
22 to call acct_isolated() to increment them.
23
24 It is possible that the bug whcih this patch fixes could cause OOM kills
25 when the system still has a lot of reclaimable page cache.
26
27 Fixes: edc2ca612496 ("mm, compaction: move pageblock checks up from isolate_migratepages_range()")
28 Signed-off-by: Hugh Dickins <hughd@google.com>
29 Acked-by: Vlastimil Babka <vbabka@suse.cz>
30 Acked-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
31 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
32 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
33 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34
35 ---
36 mm/compaction.c | 4 +++-
37 1 file changed, 3 insertions(+), 1 deletion(-)
38
39 --- a/mm/compaction.c
40 +++ b/mm/compaction.c
41 @@ -1015,8 +1015,10 @@ static isolate_migrate_t isolate_migrate
42 low_pfn = isolate_migratepages_block(cc, low_pfn, end_pfn,
43 isolate_mode);
44
45 - if (!low_pfn || cc->contended)
46 + if (!low_pfn || cc->contended) {
47 + acct_isolated(zone, cc);
48 return ISOLATE_ABORT;
49 + }
50
51 /*
52 * Either we isolated something and proceed with migration. Or