Re: [PATCH 4/6] Have zonelist contains structs with both a zonepointer and zone_idx

From: Lee Schermerhorn
Date: Tue Nov 20 2007 - 10:46:14 EST


On Fri, 2007-11-09 at 14:33 +0000, Mel Gorman wrote:
> Filtering zonelists requires very frequent use of zone_idx(). This is costly
> as it involves a lookup of another structure and a substraction operation. As
> the zone_idx is often required, it should be quickly accessible. The node
> idx could also be stored here if it was found that accessing zone->node is
> significant which may be the case on workloads where nodemasks are heavily
> used.
>
> This patch introduces a struct zoneref to store a zone pointer and a zone
> index. The zonelist then consists of an array of this struct zonerefs which
> are looked up as necessary. Helpers are given for accessing the zone index
> as well as the node index.
>
> [kamezawa.hiroyu@xxxxxxxxxxxxxx: Suggested struct zoneref instead of embedding information in pointers]
> Signed-off-by: Mel Gorman <mel@xxxxxxxxx>
> Acked-by: Christoph Lameter <clameter@xxxxxxx>
> Acked-by: David Rientjes <rientjes@xxxxxxxxxx>
> ---
>
> arch/parisc/mm/init.c | 2 -
> fs/buffer.c | 6 ++--
> include/linux/mmzone.h | 64 +++++++++++++++++++++++++++++++++++++-------
> include/linux/oom.h | 4 +-
> kernel/cpuset.c | 4 +-
> mm/hugetlb.c | 3 +-
> mm/mempolicy.c | 35 ++++++++++++++----------
> mm/oom_kill.c | 45 +++++++++++++++---------------
> mm/page_alloc.c | 59 ++++++++++++++++++++--------------------
> mm/slab.c | 2 -
> mm/slub.c | 2 -
> mm/vmscan.c | 7 ++--
> mm/vmstat.c | 5 ++-
> 13 files changed, 145 insertions(+), 93 deletions(-)
>
<snip>
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.24-rc1-mm-010_use_two_zonelists/kernel/cpuset.c linux-2.6.24-rc1-mm-020_zoneid_zonelist/kernel/cpuset.c
> --- linux-2.6.24-rc1-mm-010_use_two_zonelists/kernel/cpuset.c 2007-10-24 04:50:57.000000000 +0100
> +++ linux-2.6.24-rc1-mm-020_zoneid_zonelist/kernel/cpuset.c 2007-11-08 19:18:27.000000000 +0000
> @@ -1877,8 +1877,8 @@ int cpuset_zonelist_valid_mems_allowed(s
> {
> int i;
>
> - for (i = 0; zl->zones[i]; i++) {
> - int nid = zone_to_nid(zl->zones[i]);
> + for (i = 0; zl->_zonerefs[i].zone; i++) {
> + int nid = zonelist_node_idx(zl->_zonerefs[i]);

Should be:
+ int nid = zonelist_node_idx(&zl->_zonerefs[i]);
^
else doesn't build. Stand by for testing...

>
> if (node_isset(nid, current->mems_allowed))
> return 1;
<snip>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/