linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] switch free memory back to MIGRATE_MOVABLE
@ 2009-07-13  2:30 Shaohua Li
  2009-07-13  2:47 ` KOSAKI Motohiro
  2009-07-13  9:56 ` Mel Gorman
  0 siblings, 2 replies; 9+ messages in thread
From: Shaohua Li @ 2009-07-13  2:30 UTC (permalink / raw)
  To: linux-kernel, linux-mm; +Cc: mel, akpm

When page is back to buddy and its order is bigger than pageblock_order, we can
switch its type to MIGRATE_MOVABLE. This can reduce fragmentation. The patch
has obvious effect when read a block device and then drop caches.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
---
 mm/page_alloc.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Index: linux/mm/page_alloc.c
===================================================================
--- linux.orig/mm/page_alloc.c	2009-07-10 11:36:07.000000000 +0800
+++ linux/mm/page_alloc.c	2009-07-13 09:25:21.000000000 +0800
@@ -475,6 +475,15 @@ static inline void __free_one_page(struc
 		order++;
 	}
 	set_page_order(page, order);
+
+	if (order >= pageblock_order && migratetype != MIGRATE_MOVABLE) {
+		int i;
+
+		migratetype = MIGRATE_MOVABLE;
+		for (i = 0; i < (1 << (order - pageblock_order)); i++)
+			set_pageblock_migratetype(page +
+				i * pageblock_nr_pages, MIGRATE_MOVABLE);
+	}
 	list_add(&page->lru,
 		&zone->free_area[order].free_list[migratetype]);
 	zone->free_area[order].nr_free++;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-07-13  9:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-13  2:30 [PATCH] switch free memory back to MIGRATE_MOVABLE Shaohua Li
2009-07-13  2:47 ` KOSAKI Motohiro
2009-07-13  2:58   ` KAMEZAWA Hiroyuki
2009-07-13  3:04     ` Shaohua Li
2009-07-13  3:07       ` KAMEZAWA Hiroyuki
2009-07-13  3:08       ` KOSAKI Motohiro
2009-07-13  3:18         ` Shaohua Li
2009-07-13  5:38           ` KAMEZAWA Hiroyuki
2009-07-13  9:56 ` Mel Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).