aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2009-03-31 18:23:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:15 -0400
commit327c0e968645f2601a43f5ea7c19c7b3a5fa0a34 (patch)
treeacc6789c120a6d5000ceebf51e690d14c6cfcacb /mm/vmscan.c
parent2678958e1225f350806d90f211a3b475f64aee80 (diff)
vmscan: fix it to take care of nodemask
try_to_free_pages() is used for the direct reclaim of up to SWAP_CLUSTER_MAX pages when watermarks are low. The caller to alloc_pages_nodemask() can specify a nodemask of nodes that are allowed to be used but this is not passed to try_to_free_pages(). This can lead to unnecessary reclaim of pages that are unusable by the caller and int the worst case lead to allocation failure as progress was not been make where it is needed. This patch passes the nodemask used for alloc_pages_nodemask() to try_to_free_pages(). Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Acked-by: Mel Gorman <mel@csn.ul.ie> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f4619c6cd59e..06e72693b458 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -78,6 +78,12 @@ struct scan_control {
78 /* Which cgroup do we reclaim from */ 78 /* Which cgroup do we reclaim from */
79 struct mem_cgroup *mem_cgroup; 79 struct mem_cgroup *mem_cgroup;
80 80
81 /*
82 * Nodemask of nodes allowed by the caller. If NULL, all nodes
83 * are scanned.
84 */
85 nodemask_t *nodemask;
86
81 /* Pluggable isolate pages callback */ 87 /* Pluggable isolate pages callback */
82 unsigned long (*isolate_pages)(unsigned long nr, struct list_head *dst, 88 unsigned long (*isolate_pages)(unsigned long nr, struct list_head *dst,
83 unsigned long *scanned, int order, int mode, 89 unsigned long *scanned, int order, int mode,
@@ -1538,7 +1544,8 @@ static void shrink_zones(int priority, struct zonelist *zonelist,
1538 struct zone *zone; 1544 struct zone *zone;
1539 1545
1540 sc->all_unreclaimable = 1; 1546 sc->all_unreclaimable = 1;
1541 for_each_zone_zonelist(zone, z, zonelist, high_zoneidx) { 1547 for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx,
1548 sc->nodemask) {
1542 if (!populated_zone(zone)) 1549 if (!populated_zone(zone))
1543 continue; 1550 continue;
1544 /* 1551 /*
@@ -1683,7 +1690,7 @@ out:
1683} 1690}
1684 1691
1685unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 1692unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
1686 gfp_t gfp_mask) 1693 gfp_t gfp_mask, nodemask_t *nodemask)
1687{ 1694{
1688 struct scan_control sc = { 1695 struct scan_control sc = {
1689 .gfp_mask = gfp_mask, 1696 .gfp_mask = gfp_mask,
@@ -1694,6 +1701,7 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
1694 .order = order, 1701 .order = order,
1695 .mem_cgroup = NULL, 1702 .mem_cgroup = NULL,
1696 .isolate_pages = isolate_pages_global, 1703 .isolate_pages = isolate_pages_global,
1704 .nodemask = nodemask,
1697 }; 1705 };
1698 1706
1699 return do_try_to_free_pages(zonelist, &sc); 1707 return do_try_to_free_pages(zonelist, &sc);
@@ -1714,6 +1722,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
1714 .order = 0, 1722 .order = 0,
1715 .mem_cgroup = mem_cont, 1723 .mem_cgroup = mem_cont,
1716 .isolate_pages = mem_cgroup_isolate_pages, 1724 .isolate_pages = mem_cgroup_isolate_pages,
1725 .nodemask = NULL, /* we don't care the placement */
1717 }; 1726 };
1718 struct zonelist *zonelist; 1727 struct zonelist *zonelist;
1719 1728