linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Mel Gorman <mgorman@suse.de>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>,
	Minchan Kim <minchan@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Rik van Riel <riel@redhat.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCH V4 4/4] mm: microoptimize zonelist operations
Date: Wed, 7 Jan 2015 15:47:50 +0100	[thread overview]
Message-ID: <20150107144750.GF16553@dhcp22.suse.cz> (raw)
In-Reply-To: <20150107111706.GC2395@suse.de>

On Wed 07-01-15 11:17:07, Mel Gorman wrote:
> On Wed, Jan 07, 2015 at 11:57:49AM +0100, Michal Hocko wrote:
> > On Wed 07-01-15 10:15:39, Vlastimil Babka wrote:
> > > On 01/06/2015 04:09 PM, Michal Hocko wrote:
> > > > On Mon 05-01-15 18:17:43, Vlastimil Babka wrote:
> > > >> The function next_zones_zonelist() returns zoneref pointer, as well as zone
> > > >> pointer via extra parameter. Since the latter can be trivially obtained by
> > > >> dereferencing the former, the overhead of the extra parameter is unjustified.
> > > >> 
> > > >> This patch thus removes the zone parameter from next_zones_zonelist(). Both
> > > >> callers happen to be in the same header file, so it's simple to add the
> > > >> zoneref dereference inline. We save some bytes of code size.
> > > > 
> > > > Dunno. It makes first_zones_zonelist and next_zones_zonelist look
> > > > different which might be a bit confusing. It's not a big deal but
> > > > I am not sure it is worth it.
> > > 
> > > Yeah I thought that nobody uses them directly anyway thanks to
> > > for_each_zone_zonelist* so it's not a big deal.
> > 
> > OK, I have checked why we need the whole struct zoneref when it
> > only caches zone_idx. dd1a239f6f2d (mm: have zonelist contains
> > structs with both a zone pointer and zone_idx) claims this will
> > reduce cache contention by reducing pointer chasing because we
> > do not have to dereference pgdat so often in hot paths. Fair
> > enough but I do not see any numbers in the changelog nor in the
> > original discussion (https://lkml.org/lkml/2007/11/20/547 resp.
> > https://lkml.org/lkml/2007/9/28/170). Maybe Mel remembers what was the
> > benchmark which has shown the difference so that we can check whether
> > this is still relevant and caching the index is still worth it.
> > 
> 
> IIRC, the difference was a few percent on instruction profiles and cache
> profiles when driven from a systemtap microbenchmark but I no longer have
> the data and besides it would have been based on an ancient machine by
> todays standards. When zeroing of pages is taken into account it's going
> to be marginal so a userspace test would probably show nothing. Still,
> I see little motivation to replace a single deference with multiple
> dereferences and pointer arithmetic when zonelist_zone_idx() is called.

OK, fair enough. I have tried to convert back to simple zone * and it
turned out we wouldn't save too much code so this is really not worth
time and possible complications.
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2015-01-07 14:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 17:17 [PATCH V4 0/4] Reducing parameters of alloc_pages* family of functions Vlastimil Babka
2015-01-05 17:17 ` [PATCH V4 1/4] mm: set page->pfmemalloc in prep_new_page() Vlastimil Babka
2015-01-06 14:30   ` Michal Hocko
2015-01-06 21:10     ` Vlastimil Babka
2015-01-06 21:44       ` Michal Hocko
2015-01-07  9:36         ` Vlastimil Babka
2015-01-07 10:54           ` Michal Hocko
2015-01-05 17:17 ` [PATCH V4 2/4] mm, page_alloc: reduce number of alloc_pages* functions' parameters Vlastimil Babka
2015-01-06 14:45   ` Michal Hocko
2015-01-05 17:17 ` [PATCH V4 3/4] mm: reduce try_to_compact_pages parameters Vlastimil Babka
2015-01-06 14:53   ` Michal Hocko
2015-01-06 14:57   ` Michal Hocko
2015-01-07  9:11     ` Vlastimil Babka
2015-01-07  9:18       ` Michal Hocko
2015-01-07  9:21         ` Vlastimil Babka
2015-01-05 17:17 ` [PATCH V4 4/4] mm: microoptimize zonelist operations Vlastimil Babka
2015-01-06 15:09   ` Michal Hocko
2015-01-07  9:15     ` Vlastimil Babka
2015-01-07 10:57       ` Michal Hocko
2015-01-07 11:17         ` Mel Gorman
2015-01-07 14:47           ` Michal Hocko [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=20150107144750.GF16553@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    --cc=zhangyanfei@cn.fujitsu.com \
    /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