From: Paul Jackson Change the page cache allocation calls to support cpuset memory spreading. See the previous patch, cpuset_mem_spread, for an explanation of cpuset memory spreading. On systems without cpusets configured in the kernel, this is no change. On systems with cpusets configured in the kernel, but the "memory_spread" cpuset option not enabled for the current tasks cpuset, this adds one failed bit test of the processor state flag PF_MEM_SPREAD. On tasks in cpusets with "memory_spread" enabled, this adds a call to a cpuset routine that computes which of the tasks mems_allowed nodes should be preferred for this allocation. If memory spreading applies to a particular allocation, then any other NUMA mempolicy does not apply. Signed-off-by: Paul Jackson Signed-off-by: Andrew Morton --- include/linux/pagemap.h | 9 +++++++++ 1 files changed, 9 insertions(+) diff -puN include/linux/pagemap.h~cpuset-memory-spread-page-cache-implementation-and-hooks include/linux/pagemap.h --- devel/include/linux/pagemap.h~cpuset-memory-spread-page-cache-implementation-and-hooks 2006-02-04 15:26:03.000000000 -0800 +++ devel-akpm/include/linux/pagemap.h 2006-02-04 15:26:03.000000000 -0800 @@ -10,6 +10,7 @@ #include #include #include +#include #include /* @@ -53,11 +54,19 @@ void release_pages(struct page **pages, static inline struct page *page_cache_alloc(struct address_space *x) { + if (cpuset_mem_spread_check()) { + int n = cpuset_mem_spread_node(); + return alloc_pages_node(n, mapping_gfp_mask(x), 0); + } return alloc_pages(mapping_gfp_mask(x), 0); } static inline struct page *page_cache_alloc_cold(struct address_space *x) { + if (cpuset_mem_spread_check()) { + int n = cpuset_mem_spread_node(); + return alloc_pages_node(n, mapping_gfp_mask(x)|__GFP_COLD, 0); + } return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0); } _