linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Dirk Hohndel <dirkhh@vmware.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Jesper Dangaard Brouer <brouer@redhat.com>
Subject: Re: mm, page_alloc: Swap likely to unlikely as code logic is different for next_zones_zonelist()
Date: Fri, 6 Jan 2017 10:16:53 +0000	[thread overview]
Message-ID: <20170106101653.orsf6ahgexc4etmx@techsingularity.net> (raw)
In-Reply-To: <20170105200102.77989567@gandalf.local.home>

On Thu, Jan 05, 2017 at 08:01:02PM -0500, 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))
>                return z;
>        return __next_zones_zonelist(z, highest_zoneidx, nodes);
> 
> Where __next_zones_zonelist() is only called when nodes is not NULL or
> zonelist_zone_idx(z) is less than highest_zoneidx.
> 
> The original next_zone_zonelist() was converted to
> __next_zones_zonelist() but it still maintained:
> 
> 	if (likely(nodes == NULL))
> 
> Which is now actually a very unlikely, as it is only called with nodes
> equal to NULL when zonelist_zone_idx(z) is greater than highest_zoneidx.
> 
> Before this commit, this if had this statistic:
> 
>  correct incorrect  %        Function                  File              Line
>  ------- ---------  -        --------                  ----              ----
>   837895   446078  34 next_zones_zonelist            mmzone.c             63
> 
> After this commit, it has:
> 
>  correct incorrect  %        Function                  File              Line
>  ------- ---------  -        --------                  ----              ----
>       10   173840  99 __next_zones_zonelist          mmzone.c             63
> 
> Thus, the if statement is now much more unlikely than it ever was as a
> likely.
> 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Well spotted;

Acked-by: Mel Gorman <mgorman@techsingularity.net>

-- 
Mel Gorman
SUSE Labs

      parent reply	other threads:[~2017-01-06 10:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06  1:01 mm, page_alloc: Swap likely to unlikely as code logic is different for next_zones_zonelist() Steven Rostedt
2017-01-06  8:00 ` Vlastimil Babka
2017-01-06 14:41   ` Steven Rostedt
2017-01-06 10:16 ` Mel Gorman [this message]

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=20170106101653.orsf6ahgexc4etmx@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=akpm@linux-foundation.org \
    --cc=brouer@redhat.com \
    --cc=dirkhh@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    --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).