[PATCH mm 2/3] kill redundancy in rotate_reclaimable_page

From: Hugh Dickins
Date: Thu Sep 27 2007 - 15:50:17 EST


a.k.a. mm-use-pagevec-to-rotate-reclaimable-page-cleanup.patch

diff -U5 shows rotate_reclaimable_page() is pointlessly testing
PageActive and PageLRU twice in a row: of course there used to be a
lock taken in between those tests; but now that pagevec_move_tail() is
making those tests under lock, there's no point to repeating them here.

Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx>
---
mm/swap.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

--- 2.6.23-rc8-mm2/mm/swap.c 2007-09-27 17:51:11.000000000 +0100
+++ linux/mm/swap.c 2007-09-27 17:51:33.000000000 +0100
@@ -158,18 +158,17 @@ int rotate_reclaimable_page(struct page
if (PageActive(page))
return 1;
if (!PageLRU(page))
return 1;

- if (PageLRU(page) && !PageActive(page)) {
- page_cache_get(page);
- local_irq_save(flags);
- pvec = &__get_cpu_var(rotate_pvecs);
- if (!pagevec_add(pvec, page))
- pagevec_move_tail(pvec);
- local_irq_restore(flags);
- }
+ page_cache_get(page);
+ local_irq_save(flags);
+ pvec = &__get_cpu_var(lru_rotate_pvecs);
+ if (!pagevec_add(pvec, page))
+ pagevec_move_tail(pvec);
+ local_irq_restore(flags);
+
if (!test_clear_page_writeback(page))
BUG();

return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/