diff options
-rw-r--r-- | include/linux/swap.h | 2 | ||||
-rw-r--r-- | mm/Kconfig | 7 | ||||
-rw-r--r-- | mm/vmscan.c | 20 |
3 files changed, 20 insertions, 9 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index 893096e67bdb..117add066f00 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -178,7 +178,9 @@ extern int vm_swappiness; | |||
178 | extern int isolate_lru_page(struct page *p); | 178 | extern int isolate_lru_page(struct page *p); |
179 | extern int putback_lru_pages(struct list_head *l); | 179 | extern int putback_lru_pages(struct list_head *l); |
180 | 180 | ||
181 | #ifdef CONFIG_MIGRATION | ||
181 | extern int migrate_pages(struct list_head *l, struct list_head *t); | 182 | extern int migrate_pages(struct list_head *l, struct list_head *t); |
183 | #endif | ||
182 | 184 | ||
183 | #ifdef CONFIG_MMU | 185 | #ifdef CONFIG_MMU |
184 | /* linux/mm/shmem.c */ | 186 | /* linux/mm/shmem.c */ |
diff --git a/mm/Kconfig b/mm/Kconfig index b3db11f137e0..a9cb80ae6409 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -132,3 +132,10 @@ config SPLIT_PTLOCK_CPUS | |||
132 | default "4096" if ARM && !CPU_CACHE_VIPT | 132 | default "4096" if ARM && !CPU_CACHE_VIPT |
133 | default "4096" if PARISC && !PA20 | 133 | default "4096" if PARISC && !PA20 |
134 | default "4" | 134 | default "4" |
135 | |||
136 | # | ||
137 | # support for page migration | ||
138 | # | ||
139 | config MIGRATION | ||
140 | def_bool y if NUMA || SPARSEMEM || DISCONTIGMEM | ||
141 | depends on SWAP | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index a537a7f16357..58270aea669a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -568,6 +568,7 @@ keep: | |||
568 | return reclaimed; | 568 | return reclaimed; |
569 | } | 569 | } |
570 | 570 | ||
571 | #ifdef CONFIG_MIGRATION | ||
571 | /* | 572 | /* |
572 | * swapout a single page | 573 | * swapout a single page |
573 | * page is locked upon entry, unlocked on exit | 574 | * page is locked upon entry, unlocked on exit |
@@ -656,8 +657,9 @@ redo: | |||
656 | 657 | ||
657 | /* | 658 | /* |
658 | * Skip locked pages during the first two passes to give the | 659 | * Skip locked pages during the first two passes to give the |
659 | * functions holding the lock time to release the page. Later we use | 660 | * functions holding the lock time to release the page. Later we |
660 | * lock_page to have a higher chance of acquiring the lock. | 661 | * use lock_page() to have a higher chance of acquiring the |
662 | * lock. | ||
661 | */ | 663 | */ |
662 | if (pass > 2) | 664 | if (pass > 2) |
663 | lock_page(page); | 665 | lock_page(page); |
@@ -669,15 +671,15 @@ redo: | |||
669 | * Only wait on writeback if we have already done a pass where | 671 | * Only wait on writeback if we have already done a pass where |
670 | * we we may have triggered writeouts for lots of pages. | 672 | * we we may have triggered writeouts for lots of pages. |
671 | */ | 673 | */ |
672 | if (pass > 0) | 674 | if (pass > 0) { |
673 | wait_on_page_writeback(page); | 675 | wait_on_page_writeback(page); |
674 | else | 676 | } else { |
675 | if (PageWriteback(page)) { | 677 | if (PageWriteback(page)) { |
676 | unlock_page(page); | 678 | unlock_page(page); |
677 | goto retry_later; | 679 | goto retry_later; |
678 | } | 680 | } |
681 | } | ||
679 | 682 | ||
680 | #ifdef CONFIG_SWAP | ||
681 | if (PageAnon(page) && !PageSwapCache(page)) { | 683 | if (PageAnon(page) && !PageSwapCache(page)) { |
682 | if (!add_to_swap(page)) { | 684 | if (!add_to_swap(page)) { |
683 | unlock_page(page); | 685 | unlock_page(page); |
@@ -686,16 +688,15 @@ redo: | |||
686 | continue; | 688 | continue; |
687 | } | 689 | } |
688 | } | 690 | } |
689 | #endif /* CONFIG_SWAP */ | ||
690 | 691 | ||
691 | /* | 692 | /* |
692 | * Page is properly locked and writeback is complete. | 693 | * Page is properly locked and writeback is complete. |
693 | * Try to migrate the page. | 694 | * Try to migrate the page. |
694 | */ | 695 | */ |
695 | if (swap_page(page)) { | 696 | if (!swap_page(page)) |
697 | continue; | ||
696 | retry_later: | 698 | retry_later: |
697 | retry++; | 699 | retry++; |
698 | } | ||
699 | } | 700 | } |
700 | if (retry && pass++ < 10) | 701 | if (retry && pass++ < 10) |
701 | goto redo; | 702 | goto redo; |
@@ -708,6 +709,7 @@ retry_later: | |||
708 | 709 | ||
709 | return nr_failed + retry; | 710 | return nr_failed + retry; |
710 | } | 711 | } |
712 | #endif | ||
711 | 713 | ||
712 | /* | 714 | /* |
713 | * zone->lru_lock is heavily contended. Some of the functions that | 715 | * zone->lru_lock is heavily contended. Some of the functions that |