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

2007-11-20 Thread Lee Schermerhorn
On Fri, 2007-11-09 at 14:33 +, 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.
> 
> [EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information 
> in pointers]
> Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
> Acked-by: Christoph Lameter <[EMAIL PROTECTED]>
> Acked-by: David Rientjes <[EMAIL PROTECTED]>
> ---
> 
>  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(-)
> 

> 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.0 +0100
> +++ linux-2.6.24-rc1-mm-020_zoneid_zonelist/kernel/cpuset.c   2007-11-08 
> 19:18:27.0 +
> @@ -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(>_zonerefs[i]);
  ^
else doesn't build.  Stand by for testing...

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


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


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

2007-11-20 Thread Lee Schermerhorn
On Fri, 2007-11-09 at 14:33 +, 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.
 
 [EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information 
 in pointers]
 Signed-off-by: Mel Gorman [EMAIL PROTECTED]
 Acked-by: Christoph Lameter [EMAIL PROTECTED]
 Acked-by: David Rientjes [EMAIL PROTECTED]
 ---
 
  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.0 +0100
 +++ linux-2.6.24-rc1-mm-020_zoneid_zonelist/kernel/cpuset.c   2007-11-08 
 19:18:27.0 +
 @@ -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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] Have zonelist contains structs with both a zone pointer and zone_idx

2007-11-09 Thread Mel Gorman

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.

[EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information in 
pointers]
Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
Acked-by: Christoph Lameter <[EMAIL PROTECTED]>
Acked-by: David Rientjes <[EMAIL PROTECTED]>
---

 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(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.24-rc1-mm-010_use_two_zonelists/arch/parisc/mm/init.c 
linux-2.6.24-rc1-mm-020_zoneid_zonelist/arch/parisc/mm/init.c
--- linux-2.6.24-rc1-mm-010_use_two_zonelists/arch/parisc/mm/init.c 
2007-11-08 19:11:18.0 +
+++ linux-2.6.24-rc1-mm-020_zoneid_zonelist/arch/parisc/mm/init.c   
2007-11-08 19:18:27.0 +
@@ -608,7 +608,7 @@ void show_mem(void)
for (i = 0; i < npmem_ranges; i++) {
zl = node_zonelist(i);
for (j = 0; j < MAX_NR_ZONES; j++) {
-   struct zone **z;
+   struct zoneref *z;
struct zone *zone;
 
printk("Zone list for zone %d on node %d: ", j, 
i);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.24-rc1-mm-010_use_two_zonelists/fs/buffer.c 
linux-2.6.24-rc1-mm-020_zoneid_zonelist/fs/buffer.c
--- linux-2.6.24-rc1-mm-010_use_two_zonelists/fs/buffer.c   2007-11-08 
19:11:18.0 +
+++ linux-2.6.24-rc1-mm-020_zoneid_zonelist/fs/buffer.c 2007-11-08 
19:18:27.0 +
@@ -368,16 +368,16 @@ void invalidate_bdev(struct block_device
  */
 static void free_more_memory(void)
 {
-   struct zone **zones;
+   struct zoneref *zrefs;
int nid;
 
wakeup_pdflush(1024);
yield();
 
for_each_online_node(nid) {
-   zones = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
+   zrefs = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
gfp_zone(GFP_NOFS));
-   if (*zones)
+   if (zrefs->zone)
try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0,
GFP_NOFS);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.24-rc1-mm-010_use_two_zonelists/include/linux/mmzone.h 
linux-2.6.24-rc1-mm-020_zoneid_zonelist/include/linux/mmzone.h
--- linux-2.6.24-rc1-mm-010_use_two_zonelists/include/linux/mmzone.h
2007-11-08 19:11:18.0 +
+++ linux-2.6.24-rc1-mm-020_zoneid_zonelist/include/linux/mmzone.h  
2007-11-08 19:18:27.0 +
@@ -469,6 +469,15 @@ struct zonelist_cache;
 #endif
 
 /*
+ * This struct contains information about a zone in a zonelist. It is stored
+ * here to avoid dereferences into large structures and lookups of tables
+ */
+struct zoneref {
+   struct zone *zone;  /* Pointer to actual zone */
+   int zone_idx;   /* zone_idx(zoneref->zone) */
+};
+
+/*
  * One allocation request operates on a zonelist. A zonelist
  * is a list of zones, the first one is the 'goal' of the
  * allocation, the other zones are fallback zones, in decreasing
@@ -476,11 +485,18 @@ struct zonelist_cache;
  *
  * If zlcache_ptr is not NULL, then it is just the address of zlcache,
  * as explained above.  If zlcache_ptr is NULL, there is no zlcache.
+ * *
+ * To speed the reading of the zonelist, the zonerefs contain the zone index
+ * of the entry being read. Helper functions to access information given
+ * a struct zoneref are
+ *
+ * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
+ * zonelist_zone_idx() - Return the index of the zone for an entry
+ * zonelist_node_idx() - Return the index of the node for an entry
  */
-
 struct zonelist {
struct zonelist_cache *zlcache_ptr;  

[PATCH 4/6] Have zonelist contains structs with both a zone pointer and zone_idx

2007-11-09 Thread Mel Gorman

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.

[EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information in 
pointers]
Signed-off-by: Mel Gorman [EMAIL PROTECTED]
Acked-by: Christoph Lameter [EMAIL PROTECTED]
Acked-by: David Rientjes [EMAIL PROTECTED]
---

 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(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.24-rc1-mm-010_use_two_zonelists/arch/parisc/mm/init.c 
linux-2.6.24-rc1-mm-020_zoneid_zonelist/arch/parisc/mm/init.c
--- linux-2.6.24-rc1-mm-010_use_two_zonelists/arch/parisc/mm/init.c 
2007-11-08 19:11:18.0 +
+++ linux-2.6.24-rc1-mm-020_zoneid_zonelist/arch/parisc/mm/init.c   
2007-11-08 19:18:27.0 +
@@ -608,7 +608,7 @@ void show_mem(void)
for (i = 0; i  npmem_ranges; i++) {
zl = node_zonelist(i);
for (j = 0; j  MAX_NR_ZONES; j++) {
-   struct zone **z;
+   struct zoneref *z;
struct zone *zone;
 
printk(Zone list for zone %d on node %d: , j, 
i);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.24-rc1-mm-010_use_two_zonelists/fs/buffer.c 
linux-2.6.24-rc1-mm-020_zoneid_zonelist/fs/buffer.c
--- linux-2.6.24-rc1-mm-010_use_two_zonelists/fs/buffer.c   2007-11-08 
19:11:18.0 +
+++ linux-2.6.24-rc1-mm-020_zoneid_zonelist/fs/buffer.c 2007-11-08 
19:18:27.0 +
@@ -368,16 +368,16 @@ void invalidate_bdev(struct block_device
  */
 static void free_more_memory(void)
 {
-   struct zone **zones;
+   struct zoneref *zrefs;
int nid;
 
wakeup_pdflush(1024);
yield();
 
for_each_online_node(nid) {
-   zones = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
+   zrefs = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
gfp_zone(GFP_NOFS));
-   if (*zones)
+   if (zrefs-zone)
try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0,
GFP_NOFS);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.24-rc1-mm-010_use_two_zonelists/include/linux/mmzone.h 
linux-2.6.24-rc1-mm-020_zoneid_zonelist/include/linux/mmzone.h
--- linux-2.6.24-rc1-mm-010_use_two_zonelists/include/linux/mmzone.h
2007-11-08 19:11:18.0 +
+++ linux-2.6.24-rc1-mm-020_zoneid_zonelist/include/linux/mmzone.h  
2007-11-08 19:18:27.0 +
@@ -469,6 +469,15 @@ struct zonelist_cache;
 #endif
 
 /*
+ * This struct contains information about a zone in a zonelist. It is stored
+ * here to avoid dereferences into large structures and lookups of tables
+ */
+struct zoneref {
+   struct zone *zone;  /* Pointer to actual zone */
+   int zone_idx;   /* zone_idx(zoneref-zone) */
+};
+
+/*
  * One allocation request operates on a zonelist. A zonelist
  * is a list of zones, the first one is the 'goal' of the
  * allocation, the other zones are fallback zones, in decreasing
@@ -476,11 +485,18 @@ struct zonelist_cache;
  *
  * If zlcache_ptr is not NULL, then it is just the address of zlcache,
  * as explained above.  If zlcache_ptr is NULL, there is no zlcache.
+ * *
+ * To speed the reading of the zonelist, the zonerefs contain the zone index
+ * of the entry being read. Helper functions to access information given
+ * a struct zoneref are
+ *
+ * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
+ * zonelist_zone_idx() - Return the index of the zone for an entry
+ * zonelist_node_idx() - Return the index of the node for an entry
  */
-
 struct zonelist {
struct zonelist_cache *zlcache_ptr;   

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

2007-10-16 Thread David Rientjes
On Fri, 28 Sep 2007, 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.
> 
> [EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information 
> in pointers]
> Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
> Acked-by: Christoph Lameter <[EMAIL PROTECTED]>

OOM locking looks good, thanks.

Acked-by: David Rientjes <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2007-10-16 Thread David Rientjes
On Fri, 28 Sep 2007, 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.
 
 [EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information 
 in pointers]
 Signed-off-by: Mel Gorman [EMAIL PROTECTED]
 Acked-by: Christoph Lameter [EMAIL PROTECTED]

OOM locking looks good, thanks.

Acked-by: David Rientjes [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] Have zonelist contains structs with both a zone pointer and zone_idx

2007-09-28 Thread Mel Gorman

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.

[EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information in 
pointers]
Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
Acked-by: Christoph Lameter <[EMAIL PROTECTED]>
---

 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(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc8-mm2-010_use_two_zonelists/arch/parisc/mm/init.c 
linux-2.6.23-rc8-mm2-020_zoneid_zonelist/arch/parisc/mm/init.c
--- linux-2.6.23-rc8-mm2-010_use_two_zonelists/arch/parisc/mm/init.c
2007-09-28 15:49:16.0 +0100
+++ linux-2.6.23-rc8-mm2-020_zoneid_zonelist/arch/parisc/mm/init.c  
2007-09-28 15:49:39.0 +0100
@@ -604,7 +604,7 @@ void show_mem(void)
for (i = 0; i < npmem_ranges; i++) {
zl = node_zonelist(i);
for (j = 0; j < MAX_NR_ZONES; j++) {
-   struct zone **z;
+   struct zoneref *z;
struct zone *zone;
 
printk("Zone list for zone %d on node %d: ", j, 
i);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc8-mm2-010_use_two_zonelists/fs/buffer.c 
linux-2.6.23-rc8-mm2-020_zoneid_zonelist/fs/buffer.c
--- linux-2.6.23-rc8-mm2-010_use_two_zonelists/fs/buffer.c  2007-09-28 
15:49:16.0 +0100
+++ linux-2.6.23-rc8-mm2-020_zoneid_zonelist/fs/buffer.c2007-09-28 
15:49:39.0 +0100
@@ -368,16 +368,16 @@ void invalidate_bdev(struct block_device
  */
 static void free_more_memory(void)
 {
-   struct zone **zones;
+   struct zoneref *zrefs;
int nid;
 
wakeup_pdflush(1024);
yield();
 
for_each_online_node(nid) {
-   zones = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
+   zrefs = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
gfp_zone(GFP_NOFS));
-   if (*zones)
+   if (zrefs->zone)
try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0,
GFP_NOFS);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc8-mm2-010_use_two_zonelists/include/linux/mmzone.h 
linux-2.6.23-rc8-mm2-020_zoneid_zonelist/include/linux/mmzone.h
--- linux-2.6.23-rc8-mm2-010_use_two_zonelists/include/linux/mmzone.h   
2007-09-28 15:49:16.0 +0100
+++ linux-2.6.23-rc8-mm2-020_zoneid_zonelist/include/linux/mmzone.h 
2007-09-28 15:49:39.0 +0100
@@ -471,6 +471,15 @@ struct zonelist_cache;
 #endif
 
 /*
+ * This struct contains information about a zone in a zonelist. It is stored
+ * here to avoid dereferences into large structures and lookups of tables
+ */
+struct zoneref {
+   struct zone *zone;  /* Pointer to actual zone */
+   int zone_idx;   /* zone_idx(zoneref->zone) */
+};
+
+/*
  * One allocation request operates on a zonelist. A zonelist
  * is a list of zones, the first one is the 'goal' of the
  * allocation, the other zones are fallback zones, in decreasing
@@ -478,11 +487,18 @@ struct zonelist_cache;
  *
  * If zlcache_ptr is not NULL, then it is just the address of zlcache,
  * as explained above.  If zlcache_ptr is NULL, there is no zlcache.
+ * *
+ * To speed the reading of the zonelist, the zonerefs contain the zone index
+ * of the entry being read. Helper functions to access information given
+ * a struct zoneref are
+ *
+ * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
+ * zonelist_zone_idx() - Return the index of the zone for an entry
+ * zonelist_node_idx() - Return the index of the node for an entry
  */
-
 struct zonelist {
struct zonelist_cache *zlcache_ptr;  // NULL or 
-  

[PATCH 4/6] Have zonelist contains structs with both a zone pointer and zone_idx

2007-09-28 Thread Mel Gorman

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.

[EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information in 
pointers]
Signed-off-by: Mel Gorman [EMAIL PROTECTED]
Acked-by: Christoph Lameter [EMAIL PROTECTED]
---

 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(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc8-mm2-010_use_two_zonelists/arch/parisc/mm/init.c 
linux-2.6.23-rc8-mm2-020_zoneid_zonelist/arch/parisc/mm/init.c
--- linux-2.6.23-rc8-mm2-010_use_two_zonelists/arch/parisc/mm/init.c
2007-09-28 15:49:16.0 +0100
+++ linux-2.6.23-rc8-mm2-020_zoneid_zonelist/arch/parisc/mm/init.c  
2007-09-28 15:49:39.0 +0100
@@ -604,7 +604,7 @@ void show_mem(void)
for (i = 0; i  npmem_ranges; i++) {
zl = node_zonelist(i);
for (j = 0; j  MAX_NR_ZONES; j++) {
-   struct zone **z;
+   struct zoneref *z;
struct zone *zone;
 
printk(Zone list for zone %d on node %d: , j, 
i);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc8-mm2-010_use_two_zonelists/fs/buffer.c 
linux-2.6.23-rc8-mm2-020_zoneid_zonelist/fs/buffer.c
--- linux-2.6.23-rc8-mm2-010_use_two_zonelists/fs/buffer.c  2007-09-28 
15:49:16.0 +0100
+++ linux-2.6.23-rc8-mm2-020_zoneid_zonelist/fs/buffer.c2007-09-28 
15:49:39.0 +0100
@@ -368,16 +368,16 @@ void invalidate_bdev(struct block_device
  */
 static void free_more_memory(void)
 {
-   struct zone **zones;
+   struct zoneref *zrefs;
int nid;
 
wakeup_pdflush(1024);
yield();
 
for_each_online_node(nid) {
-   zones = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
+   zrefs = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
gfp_zone(GFP_NOFS));
-   if (*zones)
+   if (zrefs-zone)
try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0,
GFP_NOFS);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc8-mm2-010_use_two_zonelists/include/linux/mmzone.h 
linux-2.6.23-rc8-mm2-020_zoneid_zonelist/include/linux/mmzone.h
--- linux-2.6.23-rc8-mm2-010_use_two_zonelists/include/linux/mmzone.h   
2007-09-28 15:49:16.0 +0100
+++ linux-2.6.23-rc8-mm2-020_zoneid_zonelist/include/linux/mmzone.h 
2007-09-28 15:49:39.0 +0100
@@ -471,6 +471,15 @@ struct zonelist_cache;
 #endif
 
 /*
+ * This struct contains information about a zone in a zonelist. It is stored
+ * here to avoid dereferences into large structures and lookups of tables
+ */
+struct zoneref {
+   struct zone *zone;  /* Pointer to actual zone */
+   int zone_idx;   /* zone_idx(zoneref-zone) */
+};
+
+/*
  * One allocation request operates on a zonelist. A zonelist
  * is a list of zones, the first one is the 'goal' of the
  * allocation, the other zones are fallback zones, in decreasing
@@ -478,11 +487,18 @@ struct zonelist_cache;
  *
  * If zlcache_ptr is not NULL, then it is just the address of zlcache,
  * as explained above.  If zlcache_ptr is NULL, there is no zlcache.
+ * *
+ * To speed the reading of the zonelist, the zonerefs contain the zone index
+ * of the entry being read. Helper functions to access information given
+ * a struct zoneref are
+ *
+ * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
+ * zonelist_zone_idx() - Return the index of the zone for an entry
+ * zonelist_node_idx() - Return the index of the node for an entry
  */
-
 struct zonelist {
struct zonelist_cache *zlcache_ptr;  // NULL or zlcache
-  

[PATCH 4/6] Have zonelist contains structs with both a zone pointer and zone_idx

2007-09-13 Thread Mel Gorman

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 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.

[EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information in 
pointers]
Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
Acked-by: Christoph Lameter <[EMAIL PROTECTED]>
---

 arch/parisc/mm/init.c  |2 -
 fs/buffer.c|6 ++--
 include/linux/mmzone.h |   64 +---
 kernel/cpuset.c|4 +-
 mm/hugetlb.c   |3 +-
 mm/mempolicy.c |   35 ++--
 mm/oom_kill.c  |2 -
 mm/page_alloc.c|   51 +--
 mm/slab.c  |2 -
 mm/slub.c  |2 -
 mm/vmscan.c|7 ++--
 mm/vmstat.c|5 ++-
 12 files changed, 118 insertions(+), 65 deletions(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/arch/parisc/mm/init.c 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/arch/parisc/mm/init.c
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/arch/parisc/mm/init.c
2007-09-13 11:57:36.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/arch/parisc/mm/init.c  
2007-09-13 11:57:44.0 +0100
@@ -604,7 +604,7 @@ void show_mem(void)
for (i = 0; i < npmem_ranges; i++) {
zl = node_zonelist(i);
for (j = 0; j < MAX_NR_ZONES; j++) {
-   struct zone **z;
+   struct zoneref *z;
struct zone *zone;
 
printk("Zone list for zone %d on node %d: ", j, 
i);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/fs/buffer.c 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/fs/buffer.c
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/fs/buffer.c  2007-09-13 
11:57:36.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/fs/buffer.c2007-09-13 
11:57:44.0 +0100
@@ -368,16 +368,16 @@ void invalidate_bdev(struct block_device
  */
 static void free_more_memory(void)
 {
-   struct zone **zones;
+   struct zoneref *zrefs;
int nid;
 
wakeup_pdflush(1024);
yield();
 
for_each_online_node(nid) {
-   zones = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
+   zrefs = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
gfp_zone(GFP_NOFS));
-   if (*zones)
+   if (zrefs->zone)
try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0,
GFP_NOFS);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/include/linux/mmzone.h 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/include/linux/mmzone.h
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/include/linux/mmzone.h   
2007-09-13 12:00:49.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/include/linux/mmzone.h 
2007-09-13 12:00:25.0 +0100
@@ -437,6 +437,15 @@ struct zonelist_cache;
 #endif
 
 /*
+ * This struct contains information about a zone in a zonelist. It is stored
+ * here to avoid dereferences into large structures and lookups of tables
+ */
+struct zoneref {
+   struct zone *zone;  /* Pointer to actual zone */
+   int zone_idx;   /* zone_idx(zoneref->zone) */
+};
+
+/*
  * One allocation request operates on a zonelist. A zonelist
  * is a list of zones, the first one is the 'goal' of the
  * allocation, the other zones are fallback zones, in decreasing
@@ -444,11 +453,18 @@ struct zonelist_cache;
  *
  * If zlcache_ptr is not NULL, then it is just the address of zlcache,
  * as explained above.  If zlcache_ptr is NULL, there is no zlcache.
+ * *
+ * To speed the reading of the zonelist, the zonerefs contain the zone index
+ * of the entry being read. Helper functions to access information given
+ * a struct zoneref are
+ *
+ * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
+ * zonelist_zone_idx() - Return the index of the zone for an entry
+ * zonelist_node_idx() - Return the index of the node for an entry
  */
-
 struct zonelist {
struct zonelist_cache *zlcache_ptr;  // NULL or 
-   struct zone *zones[MAX_ZONES_PER_ZONELIST + 1];  

[PATCH 4/6] Have zonelist contains structs with both a zone pointer and zone_idx

2007-09-13 Thread Mel Gorman

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 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.

[EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information in 
pointers]
Signed-off-by: Mel Gorman [EMAIL PROTECTED]
Acked-by: Christoph Lameter [EMAIL PROTECTED]
---

 arch/parisc/mm/init.c  |2 -
 fs/buffer.c|6 ++--
 include/linux/mmzone.h |   64 +---
 kernel/cpuset.c|4 +-
 mm/hugetlb.c   |3 +-
 mm/mempolicy.c |   35 ++--
 mm/oom_kill.c  |2 -
 mm/page_alloc.c|   51 +--
 mm/slab.c  |2 -
 mm/slub.c  |2 -
 mm/vmscan.c|7 ++--
 mm/vmstat.c|5 ++-
 12 files changed, 118 insertions(+), 65 deletions(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/arch/parisc/mm/init.c 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/arch/parisc/mm/init.c
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/arch/parisc/mm/init.c
2007-09-13 11:57:36.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/arch/parisc/mm/init.c  
2007-09-13 11:57:44.0 +0100
@@ -604,7 +604,7 @@ void show_mem(void)
for (i = 0; i  npmem_ranges; i++) {
zl = node_zonelist(i);
for (j = 0; j  MAX_NR_ZONES; j++) {
-   struct zone **z;
+   struct zoneref *z;
struct zone *zone;
 
printk(Zone list for zone %d on node %d: , j, 
i);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/fs/buffer.c 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/fs/buffer.c
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/fs/buffer.c  2007-09-13 
11:57:36.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/fs/buffer.c2007-09-13 
11:57:44.0 +0100
@@ -368,16 +368,16 @@ void invalidate_bdev(struct block_device
  */
 static void free_more_memory(void)
 {
-   struct zone **zones;
+   struct zoneref *zrefs;
int nid;
 
wakeup_pdflush(1024);
yield();
 
for_each_online_node(nid) {
-   zones = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
+   zrefs = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
gfp_zone(GFP_NOFS));
-   if (*zones)
+   if (zrefs-zone)
try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0,
GFP_NOFS);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/include/linux/mmzone.h 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/include/linux/mmzone.h
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/include/linux/mmzone.h   
2007-09-13 12:00:49.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/include/linux/mmzone.h 
2007-09-13 12:00:25.0 +0100
@@ -437,6 +437,15 @@ struct zonelist_cache;
 #endif
 
 /*
+ * This struct contains information about a zone in a zonelist. It is stored
+ * here to avoid dereferences into large structures and lookups of tables
+ */
+struct zoneref {
+   struct zone *zone;  /* Pointer to actual zone */
+   int zone_idx;   /* zone_idx(zoneref-zone) */
+};
+
+/*
  * One allocation request operates on a zonelist. A zonelist
  * is a list of zones, the first one is the 'goal' of the
  * allocation, the other zones are fallback zones, in decreasing
@@ -444,11 +453,18 @@ struct zonelist_cache;
  *
  * If zlcache_ptr is not NULL, then it is just the address of zlcache,
  * as explained above.  If zlcache_ptr is NULL, there is no zlcache.
+ * *
+ * To speed the reading of the zonelist, the zonerefs contain the zone index
+ * of the entry being read. Helper functions to access information given
+ * a struct zoneref are
+ *
+ * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
+ * zonelist_zone_idx() - Return the index of the zone for an entry
+ * zonelist_node_idx() - Return the index of the node for an entry
  */
-
 struct zonelist {
struct zonelist_cache *zlcache_ptr;  // NULL or zlcache
-   struct zone *zones[MAX_ZONES_PER_ZONELIST + 1];  // 

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

2007-09-12 Thread Christoph Lameter
On Wed, 12 Sep 2007, Mel Gorman wrote:

>  /*
> + * This struct contains information about a zone in a zonelist. It is stored
> + * here to avoid dereferences into large structures and lookups of tables
> + */
> +struct zoneref {
> + struct zone *zone;  /* Pointer to actual zone */
> + int zone_idx;   /* zone_idx(zoneref->zone) */
> +};


Well the structure is going to be 12 bytes wide. Since pointers have to be 
aligned to 8 bytes we will effectively have to use 16 bytes anyways. There 
is no additional memory use if we would be adding another 4 bytes.

But lets get this merged. We can sort this out later. Too many 
oscillations already.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] Have zonelist contains structs with both a zone pointer and zone_idx

2007-09-12 Thread Mel Gorman

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 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.

[EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information in 
pointers]
Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
Acked-by: Christoph Lameter <[EMAIL PROTECTED]>
---

 arch/parisc/mm/init.c  |2 -
 fs/buffer.c|6 ++--
 include/linux/mmzone.h |   64 +---
 kernel/cpuset.c|4 +-
 mm/hugetlb.c   |3 +-
 mm/mempolicy.c |   35 ++--
 mm/oom_kill.c  |2 -
 mm/page_alloc.c|   51 +--
 mm/slab.c  |2 -
 mm/slub.c  |2 -
 mm/vmscan.c|5 +--
 mm/vmstat.c|5 ++-
 12 files changed, 117 insertions(+), 64 deletions(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/arch/parisc/mm/init.c 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/arch/parisc/mm/init.c
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/arch/parisc/mm/init.c
2007-09-12 16:05:27.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/arch/parisc/mm/init.c  
2007-09-12 16:05:35.0 +0100
@@ -604,7 +604,7 @@ void show_mem(void)
for (i = 0; i < npmem_ranges; i++) {
zl = node_zonelist(i);
for (j = 0; j < MAX_NR_ZONES; j++) {
-   struct zone **z;
+   struct zoneref *z;
struct zone *zone;
 
printk("Zone list for zone %d on node %d: ", j, 
i);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/fs/buffer.c 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/fs/buffer.c
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/fs/buffer.c  2007-09-12 
16:05:27.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/fs/buffer.c2007-09-12 
16:05:35.0 +0100
@@ -368,16 +368,16 @@ void invalidate_bdev(struct block_device
  */
 static void free_more_memory(void)
 {
-   struct zone **zones;
+   struct zoneref *zrefs;
int nid;
 
wakeup_pdflush(1024);
yield();
 
for_each_online_node(nid) {
-   zones = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
+   zrefs = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
gfp_zone(GFP_NOFS));
-   if (*zones)
+   if (zrefs->zone)
try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0,
GFP_NOFS);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/include/linux/mmzone.h 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/include/linux/mmzone.h
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/include/linux/mmzone.h   
2007-09-12 16:05:27.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/include/linux/mmzone.h 
2007-09-12 16:05:35.0 +0100
@@ -437,6 +437,15 @@ struct zonelist_cache;
 #endif
 
 /*
+ * This struct contains information about a zone in a zonelist. It is stored
+ * here to avoid dereferences into large structures and lookups of tables
+ */
+struct zoneref {
+   struct zone *zone;  /* Pointer to actual zone */
+   int zone_idx;   /* zone_idx(zoneref->zone) */
+};
+
+/*
  * One allocation request operates on a zonelist. A zonelist
  * is a list of zones, the first one is the 'goal' of the
  * allocation, the other zones are fallback zones, in decreasing
@@ -444,11 +453,18 @@ struct zonelist_cache;
  *
  * If zlcache_ptr is not NULL, then it is just the address of zlcache,
  * as explained above.  If zlcache_ptr is NULL, there is no zlcache.
+ * *
+ * To speed the reading of the zonelist, the zonerefs contain the zone index
+ * of the entry being read. Helper functions to access information given
+ * a struct zoneref are
+ *
+ * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
+ * zonelist_zone_idx() - Return the index of the zone for an entry
+ * zonelist_node_idx() - Return the index of the node for an entry
  */
-
 struct zonelist {
struct zonelist_cache *zlcache_ptr;  // NULL or 
-   struct zone *zones[MAX_ZONES_PER_ZONELIST + 1];  // 

[PATCH 4/6] Have zonelist contains structs with both a zone pointer and zone_idx

2007-09-12 Thread Mel Gorman

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 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.

[EMAIL PROTECTED]: Suggested struct zoneref instead of embedding information in 
pointers]
Signed-off-by: Mel Gorman [EMAIL PROTECTED]
Acked-by: Christoph Lameter [EMAIL PROTECTED]
---

 arch/parisc/mm/init.c  |2 -
 fs/buffer.c|6 ++--
 include/linux/mmzone.h |   64 +---
 kernel/cpuset.c|4 +-
 mm/hugetlb.c   |3 +-
 mm/mempolicy.c |   35 ++--
 mm/oom_kill.c  |2 -
 mm/page_alloc.c|   51 +--
 mm/slab.c  |2 -
 mm/slub.c  |2 -
 mm/vmscan.c|5 +--
 mm/vmstat.c|5 ++-
 12 files changed, 117 insertions(+), 64 deletions(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/arch/parisc/mm/init.c 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/arch/parisc/mm/init.c
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/arch/parisc/mm/init.c
2007-09-12 16:05:27.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/arch/parisc/mm/init.c  
2007-09-12 16:05:35.0 +0100
@@ -604,7 +604,7 @@ void show_mem(void)
for (i = 0; i  npmem_ranges; i++) {
zl = node_zonelist(i);
for (j = 0; j  MAX_NR_ZONES; j++) {
-   struct zone **z;
+   struct zoneref *z;
struct zone *zone;
 
printk(Zone list for zone %d on node %d: , j, 
i);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/fs/buffer.c 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/fs/buffer.c
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/fs/buffer.c  2007-09-12 
16:05:27.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/fs/buffer.c2007-09-12 
16:05:35.0 +0100
@@ -368,16 +368,16 @@ void invalidate_bdev(struct block_device
  */
 static void free_more_memory(void)
 {
-   struct zone **zones;
+   struct zoneref *zrefs;
int nid;
 
wakeup_pdflush(1024);
yield();
 
for_each_online_node(nid) {
-   zones = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
+   zrefs = first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
gfp_zone(GFP_NOFS));
-   if (*zones)
+   if (zrefs-zone)
try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0,
GFP_NOFS);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc4-mm1-010_use_two_zonelists/include/linux/mmzone.h 
linux-2.6.23-rc4-mm1-020_zoneid_zonelist/include/linux/mmzone.h
--- linux-2.6.23-rc4-mm1-010_use_two_zonelists/include/linux/mmzone.h   
2007-09-12 16:05:27.0 +0100
+++ linux-2.6.23-rc4-mm1-020_zoneid_zonelist/include/linux/mmzone.h 
2007-09-12 16:05:35.0 +0100
@@ -437,6 +437,15 @@ struct zonelist_cache;
 #endif
 
 /*
+ * This struct contains information about a zone in a zonelist. It is stored
+ * here to avoid dereferences into large structures and lookups of tables
+ */
+struct zoneref {
+   struct zone *zone;  /* Pointer to actual zone */
+   int zone_idx;   /* zone_idx(zoneref-zone) */
+};
+
+/*
  * One allocation request operates on a zonelist. A zonelist
  * is a list of zones, the first one is the 'goal' of the
  * allocation, the other zones are fallback zones, in decreasing
@@ -444,11 +453,18 @@ struct zonelist_cache;
  *
  * If zlcache_ptr is not NULL, then it is just the address of zlcache,
  * as explained above.  If zlcache_ptr is NULL, there is no zlcache.
+ * *
+ * To speed the reading of the zonelist, the zonerefs contain the zone index
+ * of the entry being read. Helper functions to access information given
+ * a struct zoneref are
+ *
+ * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
+ * zonelist_zone_idx() - Return the index of the zone for an entry
+ * zonelist_node_idx() - Return the index of the node for an entry
  */
-
 struct zonelist {
struct zonelist_cache *zlcache_ptr;  // NULL or zlcache
-   struct zone *zones[MAX_ZONES_PER_ZONELIST + 1];  // 

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

2007-09-12 Thread Christoph Lameter
On Wed, 12 Sep 2007, Mel Gorman wrote:

  /*
 + * This struct contains information about a zone in a zonelist. It is stored
 + * here to avoid dereferences into large structures and lookups of tables
 + */
 +struct zoneref {
 + struct zone *zone;  /* Pointer to actual zone */
 + int zone_idx;   /* zone_idx(zoneref-zone) */
 +};


Well the structure is going to be 12 bytes wide. Since pointers have to be 
aligned to 8 bytes we will effectively have to use 16 bytes anyways. There 
is no additional memory use if we would be adding another 4 bytes.

But lets get this merged. We can sort this out later. Too many 
oscillations already.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/