Remove unlikely(order), because we are sure order is not zero if
code reach here, also add if (page == NULL), only allocate page again if
__rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0

Signed-off-by: yalin wang <yalin.wang2...@gmail.com>
---
 mm/page_alloc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0d6f540..de82e2c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone 
*preferred_zone,
                spin_lock_irqsave(&zone->lock, flags);
 
                page = NULL;
-               if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
+               if (alloc_flags & ALLOC_HARDER) {
                        page = __rmqueue_smallest(zone, order, 
MIGRATE_HIGHATOMIC);
                        if (page)
                                trace_mm_page_alloc_zone_locked(page, order, 
migratetype);
                }
-
-               page = __rmqueue(zone, order, migratetype, gfp_flags);
+               if (page == NULL)
+                       page = __rmqueue(zone, order, migratetype, gfp_flags);
                spin_unlock(&zone->lock);
                if (!page)
                        goto failed;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to