Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1500076

[RFC PATCH 2/5] mm/page_alloc: use smallest fallback page first in movable allocation

From js1304@gmail.com
Newsgroups linux.kernel
Subject [RFC PATCH 2/5] mm/page_alloc: use smallest fallback page first in movable allocation
Date 2016-10-13 10:10 +0200
Message-ID <srJfr-Vf-1@gated-at.bofh.it> (permalink)
References <srJfr-Vf-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

When we try to find freepage in fallback buddy list, we always serach
the largest one. This would help for fragmentation if we process
unmovable/reclaimable allocation request because it could cause permanent
fragmentation on movable pageblock and spread out such allocations would
cause more fragmentation. But, movable allocation request is
rather different. It would be simply freed or migrated so it doesn't
contribute to fragmentation on the other pageblock. In this case, it would
be better not to break the precious highest order freepage so we need to
search the smallest freepage first.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 mm/page_alloc.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c4f7d05..70427bf 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2121,15 +2121,31 @@ static void unreserve_highatomic_pageblock(const struct alloc_context *ac)
 	int fallback_mt;
 	bool can_steal;
 
-	/* Find the largest possible block of pages in the other list */
-	for (current_order = MAX_ORDER-1;
-				current_order >= order && current_order <= MAX_ORDER-1;
-				--current_order) {
+	if (start_migratetype == MIGRATE_MOVABLE)
+		current_order = order;
+	else
+		current_order = MAX_ORDER - 1;
+
+	/*
+	 * Find the appropriate block of pages in the other list.
+	 * If start_migratetype is MIGRATE_UNMOVABLE/MIGRATE_RECLAIMABLE,
+	 * it would be better to find largest pageblock since it could cause
+	 * fragmentation. However, in case of MIGRATE_MOVABLE, there is no
+	 * risk about fragmentation so it would be better to use smallest one.
+	 */
+	while (current_order >= order && current_order <= MAX_ORDER - 1) {
+
 		area = &(zone->free_area[current_order]);
 		fallback_mt = find_suitable_fallback(area, current_order,
 				start_migratetype, false, &can_steal);
-		if (fallback_mt == -1)
+		if (fallback_mt == -1) {
+			if (start_migratetype == MIGRATE_MOVABLE)
+				current_order++;
+			else
+				current_order--;
+
 			continue;
+		}
 
 		page = list_first_entry(&area->free_list[fallback_mt],
 						struct page, lru);
-- 
1.9.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[RFC PATCH 2/5] mm/page_alloc: use smallest fallback page first in movable allocation js1304@gmail.com - 2016-10-13 10:10 +0200
  Re: [RFC PATCH 2/5] mm/page_alloc: use smallest fallback page first  in movable allocation Vlastimil Babka <vbabka@suse.cz> - 2016-10-13 11:20 +0200
    Re: [RFC PATCH 2/5] mm/page_alloc: use smallest fallback page first  in movable allocation Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-10-14 03:30 +0200
      Re: [RFC PATCH 2/5] mm/page_alloc: use smallest fallback page first  in movable allocation Vlastimil Babka <vbabka@suse.cz> - 2016-10-14 13:00 +0200
        Re: [RFC PATCH 2/5] mm/page_alloc: use smallest fallback page first  in movable allocation Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-10-26 06:50 +0200

csiph-web