Commit e66f0972 authored by Joonsoo Kim's avatar Joonsoo Kim Committed by Linus Torvalds
Browse files

mm, page_alloc: add unlikely macro to help compiler optimization

We rarely allocate a page with ALLOC_NO_WATERMARKS and it is used in slow
path.  For helping compiler optimization, add unlikely macro to

This patch doesn't have any effect now, because gcc already optimize this
properly.  But we cannot assume that gcc always does right and nobody
re-evaluate if gcc do proper optimization with their change, for example,
it is not optimized properly on v3.10.  So adding compiler hint here is

Signed-off-by: default avatarJoonsoo Kim <>
Acked-by: default avatarJohannes Weiner <>
Cc: Minchan Kim <>
Cc: Mel Gorman <>
Cc: Rik van Riel <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 1da6f0e1
......@@ -1909,7 +1909,7 @@ get_page_from_freelist(gfp_t gfp_mask, nodemask_t *nodemask, unsigned int order,
!cpuset_zone_allowed_softwall(zone, gfp_mask))
if (alloc_flags & ALLOC_NO_WATERMARKS)
if (unlikely(alloc_flags & ALLOC_NO_WATERMARKS))
goto try_this_zone;
* Distribute pages in proportion to the individual
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