Commit 728ec980 authored by Mel Gorman's avatar Mel Gorman Committed by Linus Torvalds
Browse files

page allocator: inline __rmqueue_smallest()

Inline __rmqueue_smallest by altering flow very slightly so that there is
only one call site.  Because there is only one call-site, this function
can then be inlined without causing text bloat.  On an x86-based config,
this patch reduces text by 16 bytes.
Signed-off-by: default avatarMel Gorman <>
Reviewed-by: default avatarChristoph Lameter <>
Reviewed-by: default avatarKOSAKI Motohiro <>
Cc: Pekka Enberg <>
Cc: Peter Zijlstra <>
Cc: Nick Piggin <>
Cc: Dave Hansen <>
Cc: Lee Schermerhorn <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent a56f57ff
......@@ -661,7 +661,8 @@ static int prep_new_page(struct page *page, int order, gfp_t gfp_flags)
* Go through the free lists for the given migratetype and remove
* the smallest available page from the freelists
static struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
static inline
struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
int migratetype)
unsigned int current_order;
......@@ -831,8 +832,7 @@ static struct page *__rmqueue_fallback(struct zone *zone, int order,
/* Use MIGRATE_RESERVE rather than fail an allocation */
return __rmqueue_smallest(zone, order, MIGRATE_RESERVE);
return NULL;
......@@ -844,11 +844,23 @@ static struct page *__rmqueue(struct zone *zone, unsigned int order,
struct page *page;
page = __rmqueue_smallest(zone, order, migratetype);
if (unlikely(!page))
if (unlikely(!page) && migratetype != MIGRATE_RESERVE) {
page = __rmqueue_fallback(zone, order, migratetype);
* Use MIGRATE_RESERVE rather than fail an allocation. goto
* is used because __rmqueue_smallest is an inline function
* and we want just one call site
if (!page) {
migratetype = MIGRATE_RESERVE;
goto retry_reserve;
return page;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment