From 013d487ff8c8a3683f2570a92307dae3c188cbc8 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Sun, 8 Jan 2006 01:00:49 -0800 Subject: [PATCH] --- yaml --- r: 16837 b: refs/heads/master c: 7cbe34cf86c673503b177ff47cfa2c7030dabb50 h: refs/heads/master i: 16835: 9c92c6fe9952432c54518de26ec3b57d1aa93c0a v: v3 --- [refs] | 2 +- trunk/include/linux/swap.h | 2 ++ trunk/mm/Kconfig | 7 +++++++ trunk/mm/vmscan.c | 20 +++++++++++--------- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index 2b5a021c0b04..65dc99af9d95 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 49d2e9cc4544369635cd6f4ef6d5bb0f757079a7 +refs/heads/master: 7cbe34cf86c673503b177ff47cfa2c7030dabb50 diff --git a/trunk/include/linux/swap.h b/trunk/include/linux/swap.h index 893096e67bdb..117add066f00 100644 --- a/trunk/include/linux/swap.h +++ b/trunk/include/linux/swap.h @@ -178,7 +178,9 @@ extern int vm_swappiness; extern int isolate_lru_page(struct page *p); extern int putback_lru_pages(struct list_head *l); +#ifdef CONFIG_MIGRATION extern int migrate_pages(struct list_head *l, struct list_head *t); +#endif #ifdef CONFIG_MMU /* linux/mm/shmem.c */ diff --git a/trunk/mm/Kconfig b/trunk/mm/Kconfig index b3db11f137e0..a9cb80ae6409 100644 --- a/trunk/mm/Kconfig +++ b/trunk/mm/Kconfig @@ -132,3 +132,10 @@ config SPLIT_PTLOCK_CPUS default "4096" if ARM && !CPU_CACHE_VIPT default "4096" if PARISC && !PA20 default "4" + +# +# support for page migration +# +config MIGRATION + def_bool y if NUMA || SPARSEMEM || DISCONTIGMEM + depends on SWAP diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index a537a7f16357..58270aea669a 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -568,6 +568,7 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc) return reclaimed; } +#ifdef CONFIG_MIGRATION /* * swapout a single page * page is locked upon entry, unlocked on exit @@ -656,8 +657,9 @@ int migrate_pages(struct list_head *l, struct list_head *t) /* * Skip locked pages during the first two passes to give the - * functions holding the lock time to release the page. Later we use - * lock_page to have a higher chance of acquiring the lock. + * functions holding the lock time to release the page. Later we + * use lock_page() to have a higher chance of acquiring the + * lock. */ if (pass > 2) lock_page(page); @@ -669,15 +671,15 @@ int migrate_pages(struct list_head *l, struct list_head *t) * Only wait on writeback if we have already done a pass where * we we may have triggered writeouts for lots of pages. */ - if (pass > 0) + if (pass > 0) { wait_on_page_writeback(page); - else + } else { if (PageWriteback(page)) { unlock_page(page); goto retry_later; } + } -#ifdef CONFIG_SWAP if (PageAnon(page) && !PageSwapCache(page)) { if (!add_to_swap(page)) { unlock_page(page); @@ -686,16 +688,15 @@ int migrate_pages(struct list_head *l, struct list_head *t) continue; } } -#endif /* CONFIG_SWAP */ /* * Page is properly locked and writeback is complete. * Try to migrate the page. */ - if (swap_page(page)) { + if (!swap_page(page)) + continue; retry_later: - retry++; - } + retry++; } if (retry && pass++ < 10) goto redo; @@ -708,6 +709,7 @@ int migrate_pages(struct list_head *l, struct list_head *t) return nr_failed + retry; } +#endif /* * zone->lru_lock is heavily contended. Some of the functions that