diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2015-09-08 18:02:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-08 18:35:28 -0400 |
commit | 02333641e2cf4ac9f23eeeb01183ed8318d346ca (patch) | |
tree | 5a7385aecd47a2016f7b8f7913c6a307e50cec42 /mm/compaction.c | |
parent | f5f61a320bf6275f37fcabf6645b4ac8e683c007 (diff) |
mm, compaction: encapsulate resetting cached scanner positions
Reseting the cached compaction scanner positions is now open-coded in
__reset_isolation_suitable() and compact_finished(). Encapsulate the
functionality in a new function reset_cached_positions().
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r-- | mm/compaction.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 2c1e1ff321bf..0dce7e87d771 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -207,6 +207,13 @@ static inline bool isolation_suitable(struct compact_control *cc, | |||
207 | return !get_pageblock_skip(page); | 207 | return !get_pageblock_skip(page); |
208 | } | 208 | } |
209 | 209 | ||
210 | static void reset_cached_positions(struct zone *zone) | ||
211 | { | ||
212 | zone->compact_cached_migrate_pfn[0] = zone->zone_start_pfn; | ||
213 | zone->compact_cached_migrate_pfn[1] = zone->zone_start_pfn; | ||
214 | zone->compact_cached_free_pfn = zone_end_pfn(zone); | ||
215 | } | ||
216 | |||
210 | /* | 217 | /* |
211 | * This function is called to clear all cached information on pageblocks that | 218 | * This function is called to clear all cached information on pageblocks that |
212 | * should be skipped for page isolation when the migrate and free page scanner | 219 | * should be skipped for page isolation when the migrate and free page scanner |
@@ -218,9 +225,6 @@ static void __reset_isolation_suitable(struct zone *zone) | |||
218 | unsigned long end_pfn = zone_end_pfn(zone); | 225 | unsigned long end_pfn = zone_end_pfn(zone); |
219 | unsigned long pfn; | 226 | unsigned long pfn; |
220 | 227 | ||
221 | zone->compact_cached_migrate_pfn[0] = start_pfn; | ||
222 | zone->compact_cached_migrate_pfn[1] = start_pfn; | ||
223 | zone->compact_cached_free_pfn = end_pfn; | ||
224 | zone->compact_blockskip_flush = false; | 228 | zone->compact_blockskip_flush = false; |
225 | 229 | ||
226 | /* Walk the zone and mark every pageblock as suitable for isolation */ | 230 | /* Walk the zone and mark every pageblock as suitable for isolation */ |
@@ -238,6 +242,8 @@ static void __reset_isolation_suitable(struct zone *zone) | |||
238 | 242 | ||
239 | clear_pageblock_skip(page); | 243 | clear_pageblock_skip(page); |
240 | } | 244 | } |
245 | |||
246 | reset_cached_positions(zone); | ||
241 | } | 247 | } |
242 | 248 | ||
243 | void reset_isolation_suitable(pg_data_t *pgdat) | 249 | void reset_isolation_suitable(pg_data_t *pgdat) |
@@ -1160,9 +1166,7 @@ static int __compact_finished(struct zone *zone, struct compact_control *cc, | |||
1160 | /* Compaction run completes if the migrate and free scanner meet */ | 1166 | /* Compaction run completes if the migrate and free scanner meet */ |
1161 | if (compact_scanners_met(cc)) { | 1167 | if (compact_scanners_met(cc)) { |
1162 | /* Let the next compaction start anew. */ | 1168 | /* Let the next compaction start anew. */ |
1163 | zone->compact_cached_migrate_pfn[0] = zone->zone_start_pfn; | 1169 | reset_cached_positions(zone); |
1164 | zone->compact_cached_migrate_pfn[1] = zone->zone_start_pfn; | ||
1165 | zone->compact_cached_free_pfn = zone_end_pfn(zone); | ||
1166 | 1170 | ||
1167 | /* | 1171 | /* |
1168 | * Mark that the PG_migrate_skip information should be cleared | 1172 | * Mark that the PG_migrate_skip information should be cleared |