Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763438AbXILIcS (ORCPT ); Wed, 12 Sep 2007 04:32:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754014AbXILIcH (ORCPT ); Wed, 12 Sep 2007 04:32:07 -0400 Received: from gir.skynet.ie ([193.1.99.77]:46332 "EHLO gir.skynet.ie" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752663AbXILIcG (ORCPT ); Wed, 12 Sep 2007 04:32:06 -0400 Date: Wed, 12 Sep 2007 09:32:04 +0100 To: KAMEZAWA Hiroyuki Cc: Lee.Schermerhorn@hp.com, akpm@linux-foundation.org, ak@suse.de, clameter@sgi.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 4/6] Embed zone_id information within the zonelist->zones pointer Message-ID: <20070912083203.GA5005@skynet.ie> References: <20070911213006.23507.19569.sendpatchset@skynet.skynet.ie> <20070911213127.23507.34058.sendpatchset@skynet.skynet.ie> <20070912165138.5deb4db4.kamezawa.hiroyu@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20070912165138.5deb4db4.kamezawa.hiroyu@jp.fujitsu.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: mel@skynet.ie (Mel Gorman) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2129 Lines: 60 On (12/09/07 16:51), KAMEZAWA Hiroyuki didst pronounce: > On Tue, 11 Sep 2007 22:31:27 +0100 (IST) > Mel Gorman wrote: > > > Using two zonelists per node requires very frequent use of zone_idx(). This > > is costly as it involves a lookup of another structure and a substraction > > operation. As struct zone is always word aligned and normally cache-line > > aligned, the pointer values have a number of 0's at the least significant > > bits of the address. > > > > This patch embeds the zone_id of a zone in the zonelist->zones pointers. > > The real zone pointer is retrieved using the zonelist_zone() helper function. > > The ID of the zone is found using zonelist_zone_idx(). To avoid accidental > > references, the zones field is renamed to _zones and the type changed to > > unsigned long. > > > At first, I welcome this patch. thanks!. > > > A comment after reading all is, how about defining zonelist as following > instead of encoding in pointer ? > == > struct zone_pointer { > struct zone *zone; > int node_id; > int zone_idx; > }; > > struct zonelist { > struct zone_pointer _zones[MAX_ZONES_PER_ZONELIST + 1]; > }; > > #define zonelist_zone(zl) (zl)->zone > #define zonelist_zone_idx(zl) (zl)->zone_idx > #ifdef CONFIG_NUMA > #define zonelist_zone_nid(zl) (zl)->node_id > #else > #define zonelist_zone_nid(zl, i) (0) > == > That is an interesting idea. I'll try it out and see what happens. Thanks > If we really want to avoid unnecessary access to "zone" while walking zonelist, > above may do something good. Cons is this makes sizeof zonlist bigger. > While this is true, it might not affect the size of struct zone because of padding. One way to find out -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/