[PATCH 12/14] page-replace-rotate.patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Zijlstra <[email protected]>

page-replace interface function:
  __page_replace_rotate_reclaimable()

This function moves the page so that it will be available to the next
candidate scan.

Removes the knowledge of the page reclaim lists from the actual function.

Signed-off-by: Peter Zijlstra <[email protected]>

 include/linux/mm_page_replace.h |   15 ++++++++++++++-
 mm/page_replace.c               |    1 -
 mm/swap.c                       |    6 +-----
 3 files changed, 15 insertions(+), 7 deletions(-)

Index: linux-2.6-git/include/linux/mm_page_replace.h
===================================================================
--- linux-2.6-git.orig/include/linux/mm_page_replace.h
+++ linux-2.6-git/include/linux/mm_page_replace.h
@@ -6,6 +6,7 @@
 #include <linux/mmzone.h>
 #include <linux/mm.h>
 #include <linux/list.h>
+#include <linux/page-flags.h>
 
 #define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
 
@@ -39,12 +40,24 @@
 
 void __page_replace_insert(struct zone *, struct page *);
 void page_replace_candidates(struct zone *, int, struct list_head *);
-static inline void page_replace_activate(struct page *page)
+
+static inline
+void page_replace_activate(struct page *page)
 {
 	SetPageActive(page);
 }
+
 void page_replace_reinsert(struct zone *, struct list_head *);
 
+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);
+	}
+}
+
 static inline void
 add_page_to_active_list(struct zone *zone, struct page *page)
 {
Index: linux-2.6-git/mm/page_replace.c
===================================================================
--- linux-2.6-git.orig/mm/page_replace.c
+++ linux-2.6-git/mm/page_replace.c
@@ -1,7 +1,6 @@
 #include <linux/mm_page_replace.h>
 #include <linux/swap.h>
 #include <linux/pagevec.h>
-#include <linux/page-flags.h>
 #include <linux/init.h>
 #include <linux/rmap.h>
 #include <linux/buffer_head.h>	/* for try_to_release_page(),
Index: linux-2.6-git/mm/swap.c
===================================================================
--- linux-2.6-git.orig/mm/swap.c
+++ linux-2.6-git/mm/swap.c
@@ -82,11 +82,7 @@ int rotate_reclaimable_page(struct page 
 
 	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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux