From: Peter Zijlstra Abstract the reclaimable condition for a page and use that in try_to_evict and rotate_reclaimable_page. Also take out the knowledge of the rotation itself. API: is the page suitable for reclaim int __page_replace_reclaimable(struct page *); rotate the page to the candidate end of the page scanner (when suitable for reclaim) void __page_replace_rotate_reclaimable(struct zone *, struct page *); Signed-off-by: Peter Zijlstra include/linux/mm_lru_policy.h | 8 ++++++++ include/linux/mm_page_replace.h | 1 + mm/swap.c | 8 +------- 3 files changed, 10 insertions(+), 7 deletions(-) Index: linux-2.6-uml/include/linux/mm_lru_policy.h =================================================================== --- linux-2.6-uml.orig/include/linux/mm_lru_policy.h 2006-02-23 22:02:15.000000000 +0100 +++ linux-2.6-uml/include/linux/mm_lru_policy.h 2006-02-23 22:02:17.000000000 +0100 @@ -48,5 +48,13 @@ static inline void page_replace_remove(s } } +static inline void __page_replace_rotate_reclaimable(struct zone *zone, struct page *page) +{ + if (PageLRU(page) && !PageActive(page)) { + list_move_tail(&page->lru, &zone->inactive_list); + inc_page_state(pgrotated); + } +} + #endif /* __KERNEL__ */ #endif /* _LINUX_MM_LRU_POLICY_H */ Index: linux-2.6-uml/include/linux/mm_page_replace.h =================================================================== --- linux-2.6-uml.orig/include/linux/mm_page_replace.h 2006-02-23 22:02:03.000000000 +0100 +++ linux-2.6-uml/include/linux/mm_page_replace.h 2006-02-23 22:02:17.000000000 +0100 @@ -58,6 +58,7 @@ extern void page_replace_candidates(stru extern void page_replace_reinsert(struct list_head *); extern void page_replace_reinsert_zone(struct zone *, struct list_head *, int); /* void page_replace_remove(struct zone *, struct page *); */ +/* void __page_replace_rotate_reclaimable(struct zone *, struct page *); */ #ifdef CONFIG_MIGRATION Index: linux-2.6-uml/mm/swap.c =================================================================== --- linux-2.6-uml.orig/mm/swap.c 2006-02-23 22:02:03.000000000 +0100 +++ linux-2.6-uml/mm/swap.c 2006-02-23 22:02:17.000000000 +0100 @@ -78,18 +78,12 @@ int rotate_reclaimable_page(struct page return 1; if (PageDirty(page)) return 1; - if (PageActive(page)) - return 1; if (!PageLRU(page)) return 1; zone = page_zone(page); spin_lock_irqsave(&zone->lru_lock, flags); - if (PageLRU(page) && !PageActive(page)) { - list_del(&page->lru); - list_add_tail(&page->lru, &zone->inactive_list); - inc_page_state(pgrotated); - } + __page_replace_rotate_reclaimable(zone, page); if (!test_clear_page_writeback(page)) BUG(); spin_unlock_irqrestore(&zone->lru_lock, flags);