Re: mm, page_alloc: Swap likely to unlikely as code logic is different for next_zones_zonelist()

From: Steven Rostedt
Date: Fri Jan 06 2017 - 09:44:31 EST


On Fri, 6 Jan 2017 09:00:23 +0100
Vlastimil Babka <vbabka@xxxxxxx> wrote:

> On 01/06/2017 02:01 AM, Steven Rostedt wrote:
> > Commit 682a3385e773 "mm, page_alloc: inline the fast path of the
> > zonelist iterator" changed how next_zones_zonelist() is called, by
> > adding a static inline function to do the fast path. This function adds:
> >
> > if (likely(!nodes && zonelist_zone_idx(z) <= highest_zoneidx))
>
> Your profiling stats posted online suggested even this one was wrong:
>
> function.file.line correct incorrect percent
> next_zones_zonelist.mmzone.h.965 216840653 25415261543 %0.85
>
> Was it bogus then, or is there other explanation? I have speculated that
> this might be due to multiple cpusets configured in the system.

I didn't have any cpusets configured on either system.

But the number is exaggerated, as it too was affected by the "constant"
optimization by gcc. But when I fixed that, it still gives me about
50%. Probably best just to remove the likely() in that case.

> Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
>
> Anyway this makes sense.
>
> Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

Thanks!

-- Steve