Do not overwrite nr_zones on !NUMA when initialising zlcache_ptr
authorMel Gorman <mel@csn.ul.ie>
Thu, 3 Jul 2008 04:27:51 +0000 (05:27 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Jul 2008 16:22:59 +0000 (09:22 -0700)
commit494de90098784b8e2797598cefdd34188884ec2e
treecef8c0655f85ed64bb7426df3eeb794c2cf27580
parentc461a973118346d5c103aaaddd62e53939fd7c67
Do not overwrite nr_zones on !NUMA when initialising zlcache_ptr

The non-NUMA case of build_zonelist_cache() would initialize the
zlcache_ptr for both node_zonelists[] to NULL.

Which is problematic, since non-NUMA only has a single node_zonelists[]
entry, and trying to zero the non-existent second one just overwrote the
nr_zones field instead.

As kswapd uses this value to determine what reclaim work is necessary,
the result is that kswapd never reclaims.  This causes processes to
stall frequently in low-memory situations as they always direct reclaim.
This patch initialises zlcache_ptr correctly.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Tested-by: Dan Williams <dan.j.williams@intel.com>
[ Simplified patch a bit ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_alloc.c