From: ChengYi He <chengyihetaipei@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@techsingularity.net>,
Michal Hocko <mhocko@suse.com>, Vlastimil Babka <vbabka@suse.cz>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <js1304@gmail.com>, Yaowei Bai <bywxiaobai@163.com>,
Xishi Qiu <qiuxishi@huawei.com>,
Alexander Duyck <alexander.h.duyck@redhat.com>,
"'Kirill A . Shutemov'" <kirill.shutemov@linux.intel.com>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
chengyihetaipei@gmail.com
Subject: [RFC PATCH 1/2] mm/page_alloc: let migration fallback support pages of requested order
Date: Sat, 30 Jan 2016 03:24:56 +0800 [thread overview]
Message-ID: <5ae5eeb4bd12d5aa95a88590594139887257276e.1454094692.git.chengyihetaipei@gmail.com> (raw)
In-Reply-To: <cover.1454094692.git.chengyihetaipei@gmail.com>
This helper function only factors out the code flow within each order
during fallback. There is no function change.
Signed-off-by: ChengYi He <chengyihetaipei@gmail.com>
---
mm/page_alloc.c | 79 +++++++++++++++++++++++++++++++++------------------------
1 file changed, 46 insertions(+), 33 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 63358d9..50c325a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1752,51 +1752,64 @@ static void unreserve_highatomic_pageblock(const struct alloc_context *ac)
}
}
-/* Remove an element from the buddy allocator from the fallback list */
static inline struct page *
-__rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype)
+__rmqueue_fallback_order(struct zone *zone, unsigned int order,
+ int start_migratetype, int current_order)
{
struct free_area *area;
- unsigned int current_order;
struct page *page;
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) {
- area = &(zone->free_area[current_order]);
- fallback_mt = find_suitable_fallback(area, current_order,
- start_migratetype, false, &can_steal);
- if (fallback_mt == -1)
- continue;
+ area = &(zone->free_area[current_order]);
+ fallback_mt = find_suitable_fallback(area, current_order,
+ start_migratetype, false, &can_steal);
+ if (fallback_mt == -1)
+ return NULL;
- page = list_first_entry(&area->free_list[fallback_mt],
- struct page, lru);
- if (can_steal)
- steal_suitable_fallback(zone, page, start_migratetype);
+ page = list_first_entry(&area->free_list[fallback_mt],
+ struct page, lru);
+ if (can_steal)
+ steal_suitable_fallback(zone, page, start_migratetype);
- /* Remove the page from the freelists */
- area->nr_free--;
- list_del(&page->lru);
- rmv_page_order(page);
+ /* Remove the page from the freelists */
+ area->nr_free--;
+ list_del(&page->lru);
+ rmv_page_order(page);
- expand(zone, page, order, current_order, area,
- start_migratetype);
- /*
- * The pcppage_migratetype may differ from pageblock's
- * migratetype depending on the decisions in
- * find_suitable_fallback(). This is OK as long as it does not
- * differ for MIGRATE_CMA pageblocks. Those can be used as
- * fallback only via special __rmqueue_cma_fallback() function
- */
- set_pcppage_migratetype(page, start_migratetype);
+ expand(zone, page, order, current_order, area,
+ start_migratetype);
+ /*
+ * The pcppage_migratetype may differ from pageblock's
+ * migratetype depending on the decisions in
+ * find_suitable_fallback(). This is OK as long as it does not
+ * differ for MIGRATE_CMA pageblocks. Those can be used as
+ * fallback only via special __rmqueue_cma_fallback() function
+ */
+ set_pcppage_migratetype(page, start_migratetype);
- trace_mm_page_alloc_extfrag(page, order, current_order,
- start_migratetype, fallback_mt);
+ trace_mm_page_alloc_extfrag(page, order, current_order,
+ start_migratetype, fallback_mt);
- return page;
+ return page;
+}
+
+/* Remove an element from the buddy allocator from the fallback list */
+static inline struct page *
+__rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype)
+{
+ unsigned int current_order;
+ struct page *page;
+
+ /* 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) {
+ page = __rmqueue_fallback_order(zone, order, start_migratetype,
+ current_order);
+
+ if (page)
+ return page;
}
return NULL;
--
1.9.1
next prev parent reply other threads:[~2016-01-29 19:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-29 19:23 [RFC PATCH 0/2] avoid external fragmentation related to migration fallback ChengYi He
2016-01-29 19:24 ` ChengYi He [this message]
2016-01-29 19:25 ` [RFC PATCH 2/2] mm/page_alloc: avoid splitting pages of order 2 and 3 in " ChengYi He
2016-01-30 10:41 ` Xishi Qiu
2016-01-29 21:03 ` [RFC PATCH 0/2] avoid external fragmentation related to " Vlastimil Babka
2016-01-30 10:21 ` Xishi Qiu
2016-02-01 13:53 ` Mel Gorman
2016-02-02 1:01 ` Xishi Qiu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5ae5eeb4bd12d5aa95a88590594139887257276e.1454094692.git.chengyihetaipei@gmail.com \
--to=chengyihetaipei@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.h.duyck@redhat.com \
--cc=bywxiaobai@163.com \
--cc=hannes@cmpxchg.org \
--cc=js1304@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=qiuxishi@huawei.com \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).