From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161320AbdAFKZM (ORCPT ); Fri, 6 Jan 2017 05:25:12 -0500 Received: from outbound-smtp05.blacknight.com ([81.17.249.38]:40331 "EHLO outbound-smtp05.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970074AbdAFKY3 (ORCPT ); Fri, 6 Jan 2017 05:24:29 -0500 Date: Fri, 6 Jan 2017 10:16:53 +0000 From: Mel Gorman To: Steven Rostedt Cc: LKML , Andrew Morton , Linus Torvalds , Dirk Hohndel , Vlastimil Babka , Jesper Dangaard Brouer Subject: Re: mm, page_alloc: Swap likely to unlikely as code logic is different for next_zones_zonelist() Message-ID: <20170106101653.orsf6ahgexc4etmx@techsingularity.net> References: <20170105200102.77989567@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20170105200102.77989567@gandalf.local.home> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) Well spotted; Acked-by: Mel Gorman -- Mel Gorman SUSE Labs