[PATCH mm 2/3] kill redundancy in rotate_reclaimable_page

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andrew Morton <akpm@...>
Cc: Hisashi Hifumi <hifumi.hisashi@...>, <linux-kernel@...>
Date: Thursday, September 27, 2007 - 3:49 pm

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@veritas.com>
---
 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;
 }
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH mm 1/3] fix BUG at include/linux/mm.h:220!, Hugh Dickins, (Thu Sep 27, 3:48 pm)
[PATCH mm 3/3] move_tail_pages into lru_add_drain, Hugh Dickins, (Thu Sep 27, 3:51 pm)
[PATCH mm 2/3] kill redundancy in rotate_reclaimable_page, Hugh Dickins, (Thu Sep 27, 3:49 pm)