All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: add the block to the tail of the list in expand()
@ 2015-07-31  9:30 ` Xishi Qiu
  0 siblings, 0 replies; 18+ messages in thread
From: Xishi Qiu @ 2015-07-31  9:30 UTC (permalink / raw)
  To: Andrew Morton, Mel Gorman, Vlastimil Babka, Johannes Weiner,
	Michal Hocko, iamjoonsoo.kim, alexander.h.duyck, sasha.levin
  Cc: Linux MM, LKML

__free_one_page() will judge whether the the next-highest order is free,
then add the block to the tail or not. So when we split large order block, 
add the small block to the tail, it will reduce fragment.

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
---
 mm/page_alloc.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 506eac8..517a11c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1267,7 +1267,12 @@ static inline void expand(struct zone *zone, struct page *page,
 			set_page_guard(zone, &page[size], high, migratetype);
 			continue;
 		}
-		list_add(&page[size].lru, &area->free_list[migratetype]);
+		/*
+		 * Add the block to the tail of the list, so it's less likely
+		 * to be used soon and more likely to be merged when the page
+		 * is freed.
+		 */
+		list_add_tail(&page[size].lru, &area->free_list[migratetype]);
 		area->nr_free++;
 		set_page_order(&page[size], high);
 	}
-- 
1.7.1


--
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 related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-08-14  7:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-31  9:30 [PATCH] mm: add the block to the tail of the list in expand() Xishi Qiu
2015-07-31  9:30 ` Xishi Qiu
2015-07-31 23:24 ` Dave Hansen
2015-07-31 23:24   ` Dave Hansen
2015-08-03  2:05   ` Xishi Qiu
2015-08-03  2:05     ` Xishi Qiu
2015-08-03  4:10     ` Dave Hansen
2015-08-03  4:10       ` Dave Hansen
2015-08-04  1:13       ` Xishi Qiu
2015-08-04  1:13         ` Xishi Qiu
2015-08-04 14:27         ` Dave Hansen
2015-08-04 14:27           ` Dave Hansen
2015-08-05  7:54           ` Xishi Qiu
2015-08-05  7:54             ` Xishi Qiu
2015-08-05 14:47             ` Dave Hansen
2015-08-05 14:47               ` Dave Hansen
2015-08-14  7:55               ` Xishi Qiu
2015-08-14  7:55                 ` Xishi Qiu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.