]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.3/vmscan-do-not-evict-inactive-pages-when-skipping-an-active-list-scan.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.3 / vmscan-do-not-evict-inactive-pages-when-skipping-an-active-list-scan.patch
1 From b39415b2731d7dec5e612d2d12595da82399eedf Mon Sep 17 00:00:00 2001
2 From: Rik van Riel <riel@redhat.com>
3 Date: Mon, 14 Dec 2009 17:59:48 -0800
4 Subject: vmscan: do not evict inactive pages when skipping an active list scan
5
6 From: Rik van Riel <riel@redhat.com>
7
8 commit b39415b2731d7dec5e612d2d12595da82399eedf upstream.
9
10 In AIM7 runs, recent kernels start swapping out anonymous pages well
11 before they should. This is due to shrink_list falling through to
12 shrink_inactive_list if !inactive_anon_is_low(zone, sc), when all we
13 really wanted to do is pre-age some anonymous pages to give them extra
14 time to be referenced while on the inactive list.
15
16 The obvious fix is to make sure that shrink_list does not fall through to
17 scanning/reclaiming inactive pages when we called it to scan one of the
18 active lists.
19
20 This change should be safe because the loop in shrink_zone ensures that we
21 will still shrink the anon and file inactive lists whenever we should.
22
23 [kosaki.motohiro@jp.fujitsu.com: inactive_file_is_low() should be inactive_anon_is_low()]
24 Reported-by: Larry Woodman <lwoodman@redhat.com>
25 Signed-off-by: Rik van Riel <riel@redhat.com>
26 Acked-by: Johannes Weiner <hannes@cmpxchg.org>
27 Cc: Tomasz Chmielewski <mangoo@wpkg.org>
28 Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
29 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
30 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
31 Cc: Rik Theys <rik.theys@gmail.com>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
33
34 ---
35 mm/vmscan.c | 18 ++++++++++++------
36 1 file changed, 12 insertions(+), 6 deletions(-)
37
38 --- a/mm/vmscan.c
39 +++ b/mm/vmscan.c
40 @@ -1464,20 +1464,26 @@ static int inactive_file_is_low(struct z
41 return low;
42 }
43
44 +static int inactive_list_is_low(struct zone *zone, struct scan_control *sc,
45 + int file)
46 +{
47 + if (file)
48 + return inactive_file_is_low(zone, sc);
49 + else
50 + return inactive_anon_is_low(zone, sc);
51 +}
52 +
53 static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
54 struct zone *zone, struct scan_control *sc, int priority)
55 {
56 int file = is_file_lru(lru);
57
58 - if (lru == LRU_ACTIVE_FILE && inactive_file_is_low(zone, sc)) {
59 - shrink_active_list(nr_to_scan, zone, sc, priority, file);
60 + if (is_active_lru(lru)) {
61 + if (inactive_list_is_low(zone, sc, file))
62 + shrink_active_list(nr_to_scan, zone, sc, priority, file);
63 return 0;
64 }
65
66 - if (lru == LRU_ACTIVE_ANON && inactive_anon_is_low(zone, sc)) {
67 - shrink_active_list(nr_to_scan, zone, sc, priority, file);
68 - return 0;
69 - }
70 return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
71 }
72