summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch143
1 files changed, 143 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch
new file mode 100644
index 00000000..7d71a05f
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch
@@ -0,0 +1,143 @@
1From 246126d86b5c74067beda5a972d4c0e1a03ec9ef Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Thu, 12 Jan 2012 17:19:41 -0800
4Subject: [PATCH 04/73] mm: page allocator: do not call direct reclaim for THP
5 allocations while compaction is deferred
6
7commit 66199712e9eef5aede09dbcd9dfff87798a66917 upstream.
8
9Stable note: Not tracked in Buzilla. This was part of a series that
10 reduced interactivity stalls experienced when THP was enabled.
11
12If compaction is deferred, direct reclaim is used to try to free enough
13pages for the allocation to succeed. For small high-orders, this has a
14reasonable chance of success. However, if the caller has specified
15__GFP_NO_KSWAPD to limit the disruption to the system, it makes more sense
16to fail the allocation rather than stall the caller in direct reclaim.
17This patch skips direct reclaim if compaction is deferred and the caller
18specifies __GFP_NO_KSWAPD.
19
20Async compaction only considers a subset of pages so it is possible for
21compaction to be deferred prematurely and not enter direct reclaim even in
22cases where it should. To compensate for this, this patch also defers
23compaction only if sync compaction failed.
24
25Signed-off-by: Mel Gorman <mgorman@suse.de>
26Acked-by: Minchan Kim <minchan.kim@gmail.com>
27Reviewed-by: Rik van Riel<riel@redhat.com>
28Cc: Andrea Arcangeli <aarcange@redhat.com>
29Cc: Dave Jones <davej@redhat.com>
30Cc: Jan Kara <jack@suse.cz>
31Cc: Andy Isaacson <adi@hexapodia.org>
32Cc: Nai Xia <nai.xia@gmail.com>
33Cc: Johannes Weiner <jweiner@redhat.com>
34Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
35Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
36Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
37---
38 mm/page_alloc.c | 45 +++++++++++++++++++++++++++++++++++----------
39 1 files changed, 35 insertions(+), 10 deletions(-)
40
41diff --git a/mm/page_alloc.c b/mm/page_alloc.c
42index cb3460e..ef6e1a1 100644
43--- a/mm/page_alloc.c
44+++ b/mm/page_alloc.c
45@@ -1886,14 +1886,20 @@ static struct page *
46 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
47 struct zonelist *zonelist, enum zone_type high_zoneidx,
48 nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone,
49- int migratetype, unsigned long *did_some_progress,
50- bool sync_migration)
51+ int migratetype, bool sync_migration,
52+ bool *deferred_compaction,
53+ unsigned long *did_some_progress)
54 {
55 struct page *page;
56
57- if (!order || compaction_deferred(preferred_zone))
58+ if (!order)
59 return NULL;
60
61+ if (compaction_deferred(preferred_zone)) {
62+ *deferred_compaction = true;
63+ return NULL;
64+ }
65+
66 current->flags |= PF_MEMALLOC;
67 *did_some_progress = try_to_compact_pages(zonelist, order, gfp_mask,
68 nodemask, sync_migration);
69@@ -1921,7 +1927,13 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
70 * but not enough to satisfy watermarks.
71 */
72 count_vm_event(COMPACTFAIL);
73- defer_compaction(preferred_zone);
74+
75+ /*
76+ * As async compaction considers a subset of pageblocks, only
77+ * defer if the failure was a sync compaction failure.
78+ */
79+ if (sync_migration)
80+ defer_compaction(preferred_zone);
81
82 cond_resched();
83 }
84@@ -1933,8 +1945,9 @@ static inline struct page *
85 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
86 struct zonelist *zonelist, enum zone_type high_zoneidx,
87 nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone,
88- int migratetype, unsigned long *did_some_progress,
89- bool sync_migration)
90+ int migratetype, bool sync_migration,
91+ bool *deferred_compaction,
92+ unsigned long *did_some_progress)
93 {
94 return NULL;
95 }
96@@ -2084,6 +2097,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
97 unsigned long pages_reclaimed = 0;
98 unsigned long did_some_progress;
99 bool sync_migration = false;
100+ bool deferred_compaction = false;
101
102 /*
103 * In the slowpath, we sanity check order to avoid ever trying to
104@@ -2164,12 +2178,22 @@ rebalance:
105 zonelist, high_zoneidx,
106 nodemask,
107 alloc_flags, preferred_zone,
108- migratetype, &did_some_progress,
109- sync_migration);
110+ migratetype, sync_migration,
111+ &deferred_compaction,
112+ &did_some_progress);
113 if (page)
114 goto got_pg;
115 sync_migration = true;
116
117+ /*
118+ * If compaction is deferred for high-order allocations, it is because
119+ * sync compaction recently failed. In this is the case and the caller
120+ * has requested the system not be heavily disrupted, fail the
121+ * allocation now instead of entering direct reclaim
122+ */
123+ if (deferred_compaction && (gfp_mask & __GFP_NO_KSWAPD))
124+ goto nopage;
125+
126 /* Try direct reclaim and then allocating */
127 page = __alloc_pages_direct_reclaim(gfp_mask, order,
128 zonelist, high_zoneidx,
129@@ -2232,8 +2256,9 @@ rebalance:
130 zonelist, high_zoneidx,
131 nodemask,
132 alloc_flags, preferred_zone,
133- migratetype, &did_some_progress,
134- sync_migration);
135+ migratetype, sync_migration,
136+ &deferred_compaction,
137+ &did_some_progress);
138 if (page)
139 goto got_pg;
140 }
141--
1421.7.7.6
143