lkml.org 
[lkml]   [2007]   [Dec]   [13]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[RFC] move free page back to MIGRATE_MOVABLE?
FromShaohua Li <>
DateThu, 13 Dec 2007 13:19:59 +0800
pages are MIGRATE_MOVABLE initially, and fallback to other types. If the
pages are freed, I wonder why not move them back to MIGRATE_MOVABLE.
This, for example, can help memory remove.

Thanks,
Shaohua 

Index: linux/mm/page_alloc.c
===================================================================
--- linux.orig/mm/page_alloc.c	2007-12-13 11:44:36.000000000 +0800
+++ linux/mm/page_alloc.c	2007-12-13 12:04:59.000000000 +0800
@@ -386,6 +386,9 @@ static inline int page_is_buddy(struct p
 	return 0;
 }
 
+int move_freepages(struct zone *zone,
+			struct page *start_page, struct page *end_page,
+			int migratetype);
 /*
  * Freeing function for a buddy system allocator.
  *
@@ -446,6 +449,17 @@ static inline void __free_one_page(struc
 	list_add(&page->lru,
 		&zone->free_area[order].free_list[migratetype]);
 	zone->free_area[order].nr_free++;
+
+	if (order >= pageblock_order && migratetype != MIGRATE_MOVABLE) {
+		struct page *tmp = page;
+
+		move_freepages(zone, page, page + (1 << order) - 1, MIGRATE_MOVABLE);
+
+		while (tmp < page + (1 << order)) {
+			set_pageblock_migratetype(tmp, MIGRATE_MOVABLE);
+			tmp += pageblock_nr_pages;
+		}
+	}
 }
 
 static inline int free_pages_check(struct page *page)

\
 
 \ /
  Last update: 2007-12-13 06:23    [from the cache]
©2003-2008