diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:39:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:39:15 -0400 |
commit | eea3a00264cf243a28e4331566ce67b86059339d (patch) | |
tree | 487f16389e0dfa32e9caa7604d1274a7dcda8f04 /mm/compaction.c | |
parent | e7c82412433a8039616c7314533a0a1c025d99bf (diff) | |
parent | e693d73c20ffdb06840c9378f367bad849ac0d5d (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge second patchbomb from Andrew Morton:
- the rest of MM
- various misc bits
- add ability to run /sbin/reboot at reboot time
- printk/vsprintf changes
- fiddle with seq_printf() return value
* akpm: (114 commits)
parisc: remove use of seq_printf return value
lru_cache: remove use of seq_printf return value
tracing: remove use of seq_printf return value
cgroup: remove use of seq_printf return value
proc: remove use of seq_printf return value
s390: remove use of seq_printf return value
cris fasttimer: remove use of seq_printf return value
cris: remove use of seq_printf return value
openrisc: remove use of seq_printf return value
ARM: plat-pxa: remove use of seq_printf return value
nios2: cpuinfo: remove use of seq_printf return value
microblaze: mb: remove use of seq_printf return value
ipc: remove use of seq_printf return value
rtc: remove use of seq_printf return value
power: wakeup: remove use of seq_printf return value
x86: mtrr: if: remove use of seq_printf return value
linux/bitmap.h: improve BITMAP_{LAST,FIRST}_WORD_MASK
MAINTAINERS: CREDITS: remove Stefano Brivio from B43
.mailmap: add Ricardo Ribalda
CREDITS: add Ricardo Ribalda Delgado
...
Diffstat (limited to 'mm/compaction.c')
-rw-r--r-- | mm/compaction.c | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index a18201a8124e..018f08da99a2 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -391,28 +391,6 @@ static inline bool compact_should_abort(struct compact_control *cc) | |||
391 | return false; | 391 | return false; |
392 | } | 392 | } |
393 | 393 | ||
394 | /* Returns true if the page is within a block suitable for migration to */ | ||
395 | static bool suitable_migration_target(struct page *page) | ||
396 | { | ||
397 | /* If the page is a large free page, then disallow migration */ | ||
398 | if (PageBuddy(page)) { | ||
399 | /* | ||
400 | * We are checking page_order without zone->lock taken. But | ||
401 | * the only small danger is that we skip a potentially suitable | ||
402 | * pageblock, so it's not worth to check order for valid range. | ||
403 | */ | ||
404 | if (page_order_unsafe(page) >= pageblock_order) | ||
405 | return false; | ||
406 | } | ||
407 | |||
408 | /* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */ | ||
409 | if (migrate_async_suitable(get_pageblock_migratetype(page))) | ||
410 | return true; | ||
411 | |||
412 | /* Otherwise skip the block */ | ||
413 | return false; | ||
414 | } | ||
415 | |||
416 | /* | 394 | /* |
417 | * Isolate free pages onto a private freelist. If @strict is true, will abort | 395 | * Isolate free pages onto a private freelist. If @strict is true, will abort |
418 | * returning 0 on any invalid PFNs or non-free pages inside of the pageblock | 396 | * returning 0 on any invalid PFNs or non-free pages inside of the pageblock |
@@ -896,6 +874,29 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn, | |||
896 | 874 | ||
897 | #endif /* CONFIG_COMPACTION || CONFIG_CMA */ | 875 | #endif /* CONFIG_COMPACTION || CONFIG_CMA */ |
898 | #ifdef CONFIG_COMPACTION | 876 | #ifdef CONFIG_COMPACTION |
877 | |||
878 | /* Returns true if the page is within a block suitable for migration to */ | ||
879 | static bool suitable_migration_target(struct page *page) | ||
880 | { | ||
881 | /* If the page is a large free page, then disallow migration */ | ||
882 | if (PageBuddy(page)) { | ||
883 | /* | ||
884 | * We are checking page_order without zone->lock taken. But | ||
885 | * the only small danger is that we skip a potentially suitable | ||
886 | * pageblock, so it's not worth to check order for valid range. | ||
887 | */ | ||
888 | if (page_order_unsafe(page) >= pageblock_order) | ||
889 | return false; | ||
890 | } | ||
891 | |||
892 | /* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */ | ||
893 | if (migrate_async_suitable(get_pageblock_migratetype(page))) | ||
894 | return true; | ||
895 | |||
896 | /* Otherwise skip the block */ | ||
897 | return false; | ||
898 | } | ||
899 | |||
899 | /* | 900 | /* |
900 | * Based on information in the current compact_control, find blocks | 901 | * Based on information in the current compact_control, find blocks |
901 | * suitable for isolating free pages from and then isolate them. | 902 | * suitable for isolating free pages from and then isolate them. |
@@ -1047,6 +1048,12 @@ typedef enum { | |||
1047 | } isolate_migrate_t; | 1048 | } isolate_migrate_t; |
1048 | 1049 | ||
1049 | /* | 1050 | /* |
1051 | * Allow userspace to control policy on scanning the unevictable LRU for | ||
1052 | * compactable pages. | ||
1053 | */ | ||
1054 | int sysctl_compact_unevictable_allowed __read_mostly = 1; | ||
1055 | |||
1056 | /* | ||
1050 | * Isolate all pages that can be migrated from the first suitable block, | 1057 | * Isolate all pages that can be migrated from the first suitable block, |
1051 | * starting at the block pointed to by the migrate scanner pfn within | 1058 | * starting at the block pointed to by the migrate scanner pfn within |
1052 | * compact_control. | 1059 | * compact_control. |
@@ -1057,6 +1064,7 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, | |||
1057 | unsigned long low_pfn, end_pfn; | 1064 | unsigned long low_pfn, end_pfn; |
1058 | struct page *page; | 1065 | struct page *page; |
1059 | const isolate_mode_t isolate_mode = | 1066 | const isolate_mode_t isolate_mode = |
1067 | (sysctl_compact_unevictable_allowed ? ISOLATE_UNEVICTABLE : 0) | | ||
1060 | (cc->mode == MIGRATE_ASYNC ? ISOLATE_ASYNC_MIGRATE : 0); | 1068 | (cc->mode == MIGRATE_ASYNC ? ISOLATE_ASYNC_MIGRATE : 0); |
1061 | 1069 | ||
1062 | /* | 1070 | /* |
@@ -1598,6 +1606,14 @@ static void __compact_pgdat(pg_data_t *pgdat, struct compact_control *cc) | |||
1598 | INIT_LIST_HEAD(&cc->freepages); | 1606 | INIT_LIST_HEAD(&cc->freepages); |
1599 | INIT_LIST_HEAD(&cc->migratepages); | 1607 | INIT_LIST_HEAD(&cc->migratepages); |
1600 | 1608 | ||
1609 | /* | ||
1610 | * When called via /proc/sys/vm/compact_memory | ||
1611 | * this makes sure we compact the whole zone regardless of | ||
1612 | * cached scanner positions. | ||
1613 | */ | ||
1614 | if (cc->order == -1) | ||
1615 | __reset_isolation_suitable(zone); | ||
1616 | |||
1601 | if (cc->order == -1 || !compaction_deferred(zone, cc->order)) | 1617 | if (cc->order == -1 || !compaction_deferred(zone, cc->order)) |
1602 | compact_zone(zone, cc); | 1618 | compact_zone(zone, cc); |
1603 | 1619 | ||