diff options
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0007-mm-vmscan-when-reclaiming-for-compaction-ensure-ther.patch')
-rw-r--r-- | recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0007-mm-vmscan-when-reclaiming-for-compaction-ensure-ther.patch | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0007-mm-vmscan-when-reclaiming-for-compaction-ensure-ther.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0007-mm-vmscan-when-reclaiming-for-compaction-ensure-ther.patch new file mode 100644 index 00000000..a3746f10 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0007-mm-vmscan-when-reclaiming-for-compaction-ensure-ther.patch | |||
@@ -0,0 +1,120 @@ | |||
1 | From 70bd5ad826ce15eedd0434f9926730716a1d5c53 Mon Sep 17 00:00:00 2001 | ||
2 | From: Mel Gorman <mgorman@suse.de> | ||
3 | Date: Thu, 12 Jan 2012 17:19:45 -0800 | ||
4 | Subject: [PATCH 07/73] mm: vmscan: when reclaiming for compaction, ensure | ||
5 | there are sufficient free pages available | ||
6 | |||
7 | commit fe4b1b244bdb96136855f2c694071cb09d140766 upstream. | ||
8 | |||
9 | Stable note: Not tracked on Bugzilla. THP and compaction was found to | ||
10 | aggressively reclaim pages and stall systems under different | ||
11 | situations that was addressed piecemeal over time. This patch | ||
12 | addresses a problem where the fix regressed THP allocation | ||
13 | success rates. | ||
14 | |||
15 | In commit e0887c19 ("vmscan: limit direct reclaim for higher order | ||
16 | allocations"), Rik noted that reclaim was too aggressive when THP was | ||
17 | enabled. In his initial patch he used the number of free pages to decide | ||
18 | if reclaim should abort for compaction. My feedback was that reclaim and | ||
19 | compaction should be using the same logic when deciding if reclaim should | ||
20 | be aborted. | ||
21 | |||
22 | Unfortunately, this had the effect of reducing THP success rates when the | ||
23 | workload included something like streaming reads that continually | ||
24 | allocated pages. The window during which compaction could run and return | ||
25 | a THP was too small. | ||
26 | |||
27 | This patch combines Rik's two patches together. compaction_suitable() is | ||
28 | still used to decide if reclaim should be aborted to allow compaction is | ||
29 | used. However, it will also ensure that there is a reasonable buffer of | ||
30 | free pages available. This improves upon the THP allocation success rates | ||
31 | but bounds the number of pages that are freed for compaction. | ||
32 | |||
33 | Signed-off-by: Mel Gorman <mgorman@suse.de> | ||
34 | Reviewed-by: Rik van Riel<riel@redhat.com> | ||
35 | Cc: Andrea Arcangeli <aarcange@redhat.com> | ||
36 | Cc: Minchan Kim <minchan.kim@gmail.com> | ||
37 | Cc: Dave Jones <davej@redhat.com> | ||
38 | Cc: Jan Kara <jack@suse.cz> | ||
39 | Cc: Andy Isaacson <adi@hexapodia.org> | ||
40 | Cc: Nai Xia <nai.xia@gmail.com> | ||
41 | Cc: Johannes Weiner <jweiner@redhat.com> | ||
42 | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> | ||
43 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | ||
44 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | ||
45 | --- | ||
46 | mm/vmscan.c | 44 +++++++++++++++++++++++++++++++++++++++----- | ||
47 | 1 files changed, 39 insertions(+), 5 deletions(-) | ||
48 | |||
49 | diff --git a/mm/vmscan.c b/mm/vmscan.c | ||
50 | index 1b95e4c..fd47744 100644 | ||
51 | --- a/mm/vmscan.c | ||
52 | +++ b/mm/vmscan.c | ||
53 | @@ -2119,6 +2119,42 @@ restart: | ||
54 | throttle_vm_writeout(sc->gfp_mask); | ||
55 | } | ||
56 | |||
57 | +/* Returns true if compaction should go ahead for a high-order request */ | ||
58 | +static inline bool compaction_ready(struct zone *zone, struct scan_control *sc) | ||
59 | +{ | ||
60 | + unsigned long balance_gap, watermark; | ||
61 | + bool watermark_ok; | ||
62 | + | ||
63 | + /* Do not consider compaction for orders reclaim is meant to satisfy */ | ||
64 | + if (sc->order <= PAGE_ALLOC_COSTLY_ORDER) | ||
65 | + return false; | ||
66 | + | ||
67 | + /* | ||
68 | + * Compaction takes time to run and there are potentially other | ||
69 | + * callers using the pages just freed. Continue reclaiming until | ||
70 | + * there is a buffer of free pages available to give compaction | ||
71 | + * a reasonable chance of completing and allocating the page | ||
72 | + */ | ||
73 | + balance_gap = min(low_wmark_pages(zone), | ||
74 | + (zone->present_pages + KSWAPD_ZONE_BALANCE_GAP_RATIO-1) / | ||
75 | + KSWAPD_ZONE_BALANCE_GAP_RATIO); | ||
76 | + watermark = high_wmark_pages(zone) + balance_gap + (2UL << sc->order); | ||
77 | + watermark_ok = zone_watermark_ok_safe(zone, 0, watermark, 0, 0); | ||
78 | + | ||
79 | + /* | ||
80 | + * If compaction is deferred, reclaim up to a point where | ||
81 | + * compaction will have a chance of success when re-enabled | ||
82 | + */ | ||
83 | + if (compaction_deferred(zone)) | ||
84 | + return watermark_ok; | ||
85 | + | ||
86 | + /* If compaction is not ready to start, keep reclaiming */ | ||
87 | + if (!compaction_suitable(zone, sc->order)) | ||
88 | + return false; | ||
89 | + | ||
90 | + return watermark_ok; | ||
91 | +} | ||
92 | + | ||
93 | /* | ||
94 | * This is the direct reclaim path, for page-allocating processes. We only | ||
95 | * try to reclaim pages from zones which will satisfy the caller's allocation | ||
96 | @@ -2136,8 +2172,8 @@ restart: | ||
97 | * scan then give up on it. | ||
98 | * | ||
99 | * This function returns true if a zone is being reclaimed for a costly | ||
100 | - * high-order allocation and compaction is either ready to begin or deferred. | ||
101 | - * This indicates to the caller that it should retry the allocation or fail. | ||
102 | + * high-order allocation and compaction is ready to begin. This indicates to | ||
103 | + * the caller that it should retry the allocation or fail. | ||
104 | */ | ||
105 | static bool shrink_zones(int priority, struct zonelist *zonelist, | ||
106 | struct scan_control *sc) | ||
107 | @@ -2171,9 +2207,7 @@ static bool shrink_zones(int priority, struct zonelist *zonelist, | ||
108 | * noticable problem, like transparent huge page | ||
109 | * allocations. | ||
110 | */ | ||
111 | - if (sc->order > PAGE_ALLOC_COSTLY_ORDER && | ||
112 | - (compaction_suitable(zone, sc->order) || | ||
113 | - compaction_deferred(zone))) { | ||
114 | + if (compaction_ready(zone, sc)) { | ||
115 | should_abort_reclaim = true; | ||
116 | continue; | ||
117 | } | ||
118 | -- | ||
119 | 1.7.7.6 | ||
120 | |||