Commit 7cbe34cf86c673503b177ff47cfa2c7030dabb50
Committed by
Linus Torvalds
1 parent
49d2e9cc45
Exists in
master
and in
20 other branches
[PATCH] Swap Migration V5: Add CONFIG_MIGRATION for page migration support
Include page migration if the system is NUMA or having a memory model that allows distinct areas of memory (SPARSEMEM, DISCONTIGMEM). And: - Only include lru_add_drain_per_cpu if building for an SMP system. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 3 changed files with 20 additions and 9 deletions Side-by-side Diff
include/linux/swap.h
... | ... | @@ -178,7 +178,9 @@ |
178 | 178 | extern int isolate_lru_page(struct page *p); |
179 | 179 | extern int putback_lru_pages(struct list_head *l); |
180 | 180 | |
181 | +#ifdef CONFIG_MIGRATION | |
181 | 182 | extern int migrate_pages(struct list_head *l, struct list_head *t); |
183 | +#endif | |
182 | 184 | |
183 | 185 | #ifdef CONFIG_MMU |
184 | 186 | /* linux/mm/shmem.c */ |
mm/Kconfig
mm/vmscan.c
... | ... | @@ -568,6 +568,7 @@ |
568 | 568 | return reclaimed; |
569 | 569 | } |
570 | 570 | |
571 | +#ifdef CONFIG_MIGRATION | |
571 | 572 | /* |
572 | 573 | * swapout a single page |
573 | 574 | * page is locked upon entry, unlocked on exit |
... | ... | @@ -656,8 +657,9 @@ |
656 | 657 | |
657 | 658 | /* |
658 | 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 | - * lock_page to have a higher chance of acquiring the lock. | |
660 | + * functions holding the lock time to release the page. Later we | |
661 | + * use lock_page() to have a higher chance of acquiring the | |
662 | + * lock. | |
661 | 663 | */ |
662 | 664 | if (pass > 2) |
663 | 665 | lock_page(page); |
664 | 666 | |
665 | 667 | |
666 | 668 | |
... | ... | @@ -669,15 +671,15 @@ |
669 | 671 | * Only wait on writeback if we have already done a pass where |
670 | 672 | * we we may have triggered writeouts for lots of pages. |
671 | 673 | */ |
672 | - if (pass > 0) | |
674 | + if (pass > 0) { | |
673 | 675 | wait_on_page_writeback(page); |
674 | - else | |
676 | + } else { | |
675 | 677 | if (PageWriteback(page)) { |
676 | 678 | unlock_page(page); |
677 | 679 | goto retry_later; |
678 | 680 | } |
681 | + } | |
679 | 682 | |
680 | -#ifdef CONFIG_SWAP | |
681 | 683 | if (PageAnon(page) && !PageSwapCache(page)) { |
682 | 684 | if (!add_to_swap(page)) { |
683 | 685 | unlock_page(page); |
684 | 686 | |
685 | 687 | |
... | ... | @@ -686,16 +688,15 @@ |
686 | 688 | continue; |
687 | 689 | } |
688 | 690 | } |
689 | -#endif /* CONFIG_SWAP */ | |
690 | 691 | |
691 | 692 | /* |
692 | 693 | * Page is properly locked and writeback is complete. |
693 | 694 | * Try to migrate the page. |
694 | 695 | */ |
695 | - if (swap_page(page)) { | |
696 | + if (!swap_page(page)) | |
697 | + continue; | |
696 | 698 | retry_later: |
697 | - retry++; | |
698 | - } | |
699 | + retry++; | |
699 | 700 | } |
700 | 701 | if (retry && pass++ < 10) |
701 | 702 | goto redo; |
... | ... | @@ -708,6 +709,7 @@ |
708 | 709 | |
709 | 710 | return nr_failed + retry; |
710 | 711 | } |
712 | +#endif | |
711 | 713 | |
712 | 714 | /* |
713 | 715 | * zone->lru_lock is heavily contended. Some of the functions that |