aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMel Gorman <mgorman@techsingularity.net>2016-07-28 18:46:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-28 19:07:41 -0400
commita5f5f91da6ad647fb0cc7fce0e17343c0d1c5a9a (patch)
tree0249dc4f9dd74daebc1d9aceac95992368834386
parent52e9f87ae8be96a863e44c7d8d7f482fb279dddd (diff)
mm: convert zone_reclaim to node_reclaim
As reclaim is now per-node based, convert zone_reclaim to be node_reclaim. It is possible that a node will be reclaimed multiple times if it has multiple zones but this is unavoidable without caching all nodes traversed so far. The documentation and interface to userspace is the same from a configuration perspective and will will be similar in behaviour unless the node-local allocation requests were also limited to lower zones. Link: http://lkml.kernel.org/r/1467970510-21195-24-git-send-email-mgorman@techsingularity.net Signed-off-by: Mel Gorman <mgorman@techsingularity.net> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Hillf Danton <hillf.zj@alibaba-inc.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: Minchan Kim <minchan@kernel.org> Cc: Rik van Riel <riel@surriel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/mmzone.h18
-rw-r--r--include/linux/swap.h9
-rw-r--r--include/linux/topology.h2
-rw-r--r--kernel/sysctl.c4
-rw-r--r--mm/internal.h8
-rw-r--r--mm/khugepaged.c4
-rw-r--r--mm/page_alloc.c24
-rw-r--r--mm/vmscan.c77
8 files changed, 77 insertions, 69 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index e3d6d42722a0..e19c081c794e 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -372,14 +372,6 @@ struct zone {
372 unsigned long *pageblock_flags; 372 unsigned long *pageblock_flags;
373#endif /* CONFIG_SPARSEMEM */ 373#endif /* CONFIG_SPARSEMEM */
374 374
375#ifdef CONFIG_NUMA
376 /*
377 * zone reclaim becomes active if more unmapped pages exist.
378 */
379 unsigned long min_unmapped_pages;
380 unsigned long min_slab_pages;
381#endif /* CONFIG_NUMA */
382
383 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ 375 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
384 unsigned long zone_start_pfn; 376 unsigned long zone_start_pfn;
385 377
@@ -525,7 +517,6 @@ struct zone {
525} ____cacheline_internodealigned_in_smp; 517} ____cacheline_internodealigned_in_smp;
526 518
527enum zone_flags { 519enum zone_flags {
528 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */
529 ZONE_FAIR_DEPLETED, /* fair zone policy batch depleted */ 520 ZONE_FAIR_DEPLETED, /* fair zone policy batch depleted */
530}; 521};
531 522
@@ -540,6 +531,7 @@ enum pgdat_flags {
540 PGDAT_WRITEBACK, /* reclaim scanning has recently found 531 PGDAT_WRITEBACK, /* reclaim scanning has recently found
541 * many pages under writeback 532 * many pages under writeback
542 */ 533 */
534 PGDAT_RECLAIM_LOCKED, /* prevents concurrent reclaim */
543}; 535};
544 536
545static inline unsigned long zone_end_pfn(const struct zone *zone) 537static inline unsigned long zone_end_pfn(const struct zone *zone)
@@ -688,6 +680,14 @@ typedef struct pglist_data {
688 */ 680 */
689 unsigned long totalreserve_pages; 681 unsigned long totalreserve_pages;
690 682
683#ifdef CONFIG_NUMA
684 /*
685 * zone reclaim becomes active if more unmapped pages exist.
686 */
687 unsigned long min_unmapped_pages;
688 unsigned long min_slab_pages;
689#endif /* CONFIG_NUMA */
690
691 /* Write-intensive fields used by page reclaim */ 691 /* Write-intensive fields used by page reclaim */
692 ZONE_PADDING(_pad1_) 692 ZONE_PADDING(_pad1_)
693 spinlock_t lru_lock; 693 spinlock_t lru_lock;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 2a23ddc96edd..b17cc4830fa6 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -326,13 +326,14 @@ extern int remove_mapping(struct address_space *mapping, struct page *page);
326extern unsigned long vm_total_pages; 326extern unsigned long vm_total_pages;
327 327
328#ifdef CONFIG_NUMA 328#ifdef CONFIG_NUMA
329extern int zone_reclaim_mode; 329extern int node_reclaim_mode;
330extern int sysctl_min_unmapped_ratio; 330extern int sysctl_min_unmapped_ratio;
331extern int sysctl_min_slab_ratio; 331extern int sysctl_min_slab_ratio;
332extern int zone_reclaim(struct zone *, gfp_t, unsigned int); 332extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int);
333#else 333#else
334#define zone_reclaim_mode 0 334#define node_reclaim_mode 0
335static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order) 335static inline int node_reclaim(struct pglist_data *pgdat, gfp_t mask,
336 unsigned int order)
336{ 337{
337 return 0; 338 return 0;
338} 339}
diff --git a/include/linux/topology.h b/include/linux/topology.h
index afce69296ac0..cb0775e1ee4b 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -54,7 +54,7 @@ int arch_update_cpu_topology(void);
54/* 54/*
55 * If the distance between nodes in a system is larger than RECLAIM_DISTANCE 55 * If the distance between nodes in a system is larger than RECLAIM_DISTANCE
56 * (in whatever arch specific measurement units returned by node_distance()) 56 * (in whatever arch specific measurement units returned by node_distance())
57 * and zone_reclaim_mode is enabled then the VM will only call zone_reclaim() 57 * and node_reclaim_mode is enabled then the VM will only call node_reclaim()
58 * on nodes within this distance. 58 * on nodes within this distance.
59 */ 59 */
60#define RECLAIM_DISTANCE 30 60#define RECLAIM_DISTANCE 30
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 35f0dcb1cb4f..53954631a4e1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1508,8 +1508,8 @@ static struct ctl_table vm_table[] = {
1508#ifdef CONFIG_NUMA 1508#ifdef CONFIG_NUMA
1509 { 1509 {
1510 .procname = "zone_reclaim_mode", 1510 .procname = "zone_reclaim_mode",
1511 .data = &zone_reclaim_mode, 1511 .data = &node_reclaim_mode,
1512 .maxlen = sizeof(zone_reclaim_mode), 1512 .maxlen = sizeof(node_reclaim_mode),
1513 .mode = 0644, 1513 .mode = 0644,
1514 .proc_handler = proc_dointvec, 1514 .proc_handler = proc_dointvec,
1515 .extra1 = &zero, 1515 .extra1 = &zero,
diff --git a/mm/internal.h b/mm/internal.h
index 2f80d0343c56..1e21b2d3838d 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -433,10 +433,10 @@ static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,
433} 433}
434#endif /* CONFIG_SPARSEMEM */ 434#endif /* CONFIG_SPARSEMEM */
435 435
436#define ZONE_RECLAIM_NOSCAN -2 436#define NODE_RECLAIM_NOSCAN -2
437#define ZONE_RECLAIM_FULL -1 437#define NODE_RECLAIM_FULL -1
438#define ZONE_RECLAIM_SOME 0 438#define NODE_RECLAIM_SOME 0
439#define ZONE_RECLAIM_SUCCESS 1 439#define NODE_RECLAIM_SUCCESS 1
440 440
441extern int hwpoison_filter(struct page *p); 441extern int hwpoison_filter(struct page *p);
442 442
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index d03b14a6ef5e..d1423d790f6d 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -672,10 +672,10 @@ static bool khugepaged_scan_abort(int nid)
672 int i; 672 int i;
673 673
674 /* 674 /*
675 * If zone_reclaim_mode is disabled, then no extra effort is made to 675 * If node_reclaim_mode is disabled, then no extra effort is made to
676 * allocate memory locally. 676 * allocate memory locally.
677 */ 677 */
678 if (!zone_reclaim_mode) 678 if (!node_reclaim_mode)
679 return false; 679 return false;
680 680
681 /* If there is a count for this node already, it must be acceptable */ 681 /* If there is a count for this node already, it must be acceptable */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f2c56a13b065..c9d1720c58a3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2942,16 +2942,16 @@ zonelist_scan:
2942 if (alloc_flags & ALLOC_NO_WATERMARKS) 2942 if (alloc_flags & ALLOC_NO_WATERMARKS)
2943 goto try_this_zone; 2943 goto try_this_zone;
2944 2944
2945 if (zone_reclaim_mode == 0 || 2945 if (node_reclaim_mode == 0 ||
2946 !zone_allows_reclaim(ac->preferred_zoneref->zone, zone)) 2946 !zone_allows_reclaim(ac->preferred_zoneref->zone, zone))
2947 continue; 2947 continue;
2948 2948
2949 ret = zone_reclaim(zone, gfp_mask, order); 2949 ret = node_reclaim(zone->zone_pgdat, gfp_mask, order);
2950 switch (ret) { 2950 switch (ret) {
2951 case ZONE_RECLAIM_NOSCAN: 2951 case NODE_RECLAIM_NOSCAN:
2952 /* did not scan */ 2952 /* did not scan */
2953 continue; 2953 continue;
2954 case ZONE_RECLAIM_FULL: 2954 case NODE_RECLAIM_FULL:
2955 /* scanned but unreclaimable */ 2955 /* scanned but unreclaimable */
2956 continue; 2956 continue;
2957 default: 2957 default:
@@ -5948,9 +5948,9 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)
5948 zone->managed_pages = is_highmem_idx(j) ? realsize : freesize; 5948 zone->managed_pages = is_highmem_idx(j) ? realsize : freesize;
5949#ifdef CONFIG_NUMA 5949#ifdef CONFIG_NUMA
5950 zone->node = nid; 5950 zone->node = nid;
5951 zone->min_unmapped_pages = (freesize*sysctl_min_unmapped_ratio) 5951 pgdat->min_unmapped_pages += (freesize*sysctl_min_unmapped_ratio)
5952 / 100; 5952 / 100;
5953 zone->min_slab_pages = (freesize * sysctl_min_slab_ratio) / 100; 5953 pgdat->min_slab_pages += (freesize * sysctl_min_slab_ratio) / 100;
5954#endif 5954#endif
5955 zone->name = zone_names[j]; 5955 zone->name = zone_names[j];
5956 zone->zone_pgdat = pgdat; 5956 zone->zone_pgdat = pgdat;
@@ -6922,6 +6922,7 @@ int watermark_scale_factor_sysctl_handler(struct ctl_table *table, int write,
6922int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write, 6922int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write,
6923 void __user *buffer, size_t *length, loff_t *ppos) 6923 void __user *buffer, size_t *length, loff_t *ppos)
6924{ 6924{
6925 struct pglist_data *pgdat;
6925 struct zone *zone; 6926 struct zone *zone;
6926 int rc; 6927 int rc;
6927 6928
@@ -6929,8 +6930,11 @@ int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write,
6929 if (rc) 6930 if (rc)
6930 return rc; 6931 return rc;
6931 6932
6933 for_each_online_pgdat(pgdat)
6934 pgdat->min_slab_pages = 0;
6935
6932 for_each_zone(zone) 6936 for_each_zone(zone)
6933 zone->min_unmapped_pages = (zone->managed_pages * 6937 zone->zone_pgdat->min_unmapped_pages += (zone->managed_pages *
6934 sysctl_min_unmapped_ratio) / 100; 6938 sysctl_min_unmapped_ratio) / 100;
6935 return 0; 6939 return 0;
6936} 6940}
@@ -6938,6 +6942,7 @@ int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write,
6938int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write, 6942int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write,
6939 void __user *buffer, size_t *length, loff_t *ppos) 6943 void __user *buffer, size_t *length, loff_t *ppos)
6940{ 6944{
6945 struct pglist_data *pgdat;
6941 struct zone *zone; 6946 struct zone *zone;
6942 int rc; 6947 int rc;
6943 6948
@@ -6945,8 +6950,11 @@ int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write,
6945 if (rc) 6950 if (rc)
6946 return rc; 6951 return rc;
6947 6952
6953 for_each_online_pgdat(pgdat)
6954 pgdat->min_slab_pages = 0;
6955
6948 for_each_zone(zone) 6956 for_each_zone(zone)
6949 zone->min_slab_pages = (zone->managed_pages * 6957 zone->zone_pgdat->min_slab_pages += (zone->managed_pages *
6950 sysctl_min_slab_ratio) / 100; 6958 sysctl_min_slab_ratio) / 100;
6951 return 0; 6959 return 0;
6952} 6960}
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 31edd7776289..1013f37cd815 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3565,12 +3565,12 @@ module_init(kswapd_init)
3565 3565
3566#ifdef CONFIG_NUMA 3566#ifdef CONFIG_NUMA
3567/* 3567/*
3568 * Zone reclaim mode 3568 * Node reclaim mode
3569 * 3569 *
3570 * If non-zero call zone_reclaim when the number of free pages falls below 3570 * If non-zero call node_reclaim when the number of free pages falls below
3571 * the watermarks. 3571 * the watermarks.
3572 */ 3572 */
3573int zone_reclaim_mode __read_mostly; 3573int node_reclaim_mode __read_mostly;
3574 3574
3575#define RECLAIM_OFF 0 3575#define RECLAIM_OFF 0
3576#define RECLAIM_ZONE (1<<0) /* Run shrink_inactive_list on the zone */ 3576#define RECLAIM_ZONE (1<<0) /* Run shrink_inactive_list on the zone */
@@ -3578,14 +3578,14 @@ int zone_reclaim_mode __read_mostly;
3578#define RECLAIM_UNMAP (1<<2) /* Unmap pages during reclaim */ 3578#define RECLAIM_UNMAP (1<<2) /* Unmap pages during reclaim */
3579 3579
3580/* 3580/*
3581 * Priority for ZONE_RECLAIM. This determines the fraction of pages 3581 * Priority for NODE_RECLAIM. This determines the fraction of pages
3582 * of a node considered for each zone_reclaim. 4 scans 1/16th of 3582 * of a node considered for each zone_reclaim. 4 scans 1/16th of
3583 * a zone. 3583 * a zone.
3584 */ 3584 */
3585#define ZONE_RECLAIM_PRIORITY 4 3585#define NODE_RECLAIM_PRIORITY 4
3586 3586
3587/* 3587/*
3588 * Percentage of pages in a zone that must be unmapped for zone_reclaim to 3588 * Percentage of pages in a zone that must be unmapped for node_reclaim to
3589 * occur. 3589 * occur.
3590 */ 3590 */
3591int sysctl_min_unmapped_ratio = 1; 3591int sysctl_min_unmapped_ratio = 1;
@@ -3611,7 +3611,7 @@ static inline unsigned long node_unmapped_file_pages(struct pglist_data *pgdat)
3611} 3611}
3612 3612
3613/* Work out how many page cache pages we can reclaim in this reclaim_mode */ 3613/* Work out how many page cache pages we can reclaim in this reclaim_mode */
3614static unsigned long zone_pagecache_reclaimable(struct zone *zone) 3614static unsigned long node_pagecache_reclaimable(struct pglist_data *pgdat)
3615{ 3615{
3616 unsigned long nr_pagecache_reclaimable; 3616 unsigned long nr_pagecache_reclaimable;
3617 unsigned long delta = 0; 3617 unsigned long delta = 0;
@@ -3622,14 +3622,14 @@ static unsigned long zone_pagecache_reclaimable(struct zone *zone)
3622 * pages like swapcache and node_unmapped_file_pages() provides 3622 * pages like swapcache and node_unmapped_file_pages() provides
3623 * a better estimate 3623 * a better estimate
3624 */ 3624 */
3625 if (zone_reclaim_mode & RECLAIM_UNMAP) 3625 if (node_reclaim_mode & RECLAIM_UNMAP)
3626 nr_pagecache_reclaimable = node_page_state(zone->zone_pgdat, NR_FILE_PAGES); 3626 nr_pagecache_reclaimable = node_page_state(pgdat, NR_FILE_PAGES);
3627 else 3627 else
3628 nr_pagecache_reclaimable = node_unmapped_file_pages(zone->zone_pgdat); 3628 nr_pagecache_reclaimable = node_unmapped_file_pages(pgdat);
3629 3629
3630 /* If we can't clean pages, remove dirty pages from consideration */ 3630 /* If we can't clean pages, remove dirty pages from consideration */
3631 if (!(zone_reclaim_mode & RECLAIM_WRITE)) 3631 if (!(node_reclaim_mode & RECLAIM_WRITE))
3632 delta += node_page_state(zone->zone_pgdat, NR_FILE_DIRTY); 3632 delta += node_page_state(pgdat, NR_FILE_DIRTY);
3633 3633
3634 /* Watch for any possible underflows due to delta */ 3634 /* Watch for any possible underflows due to delta */
3635 if (unlikely(delta > nr_pagecache_reclaimable)) 3635 if (unlikely(delta > nr_pagecache_reclaimable))
@@ -3639,23 +3639,24 @@ static unsigned long zone_pagecache_reclaimable(struct zone *zone)
3639} 3639}
3640 3640
3641/* 3641/*
3642 * Try to free up some pages from this zone through reclaim. 3642 * Try to free up some pages from this node through reclaim.
3643 */ 3643 */
3644static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) 3644static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
3645{ 3645{
3646 /* Minimum pages needed in order to stay on node */ 3646 /* Minimum pages needed in order to stay on node */
3647 const unsigned long nr_pages = 1 << order; 3647 const unsigned long nr_pages = 1 << order;
3648 struct task_struct *p = current; 3648 struct task_struct *p = current;
3649 struct reclaim_state reclaim_state; 3649 struct reclaim_state reclaim_state;
3650 int classzone_idx = gfp_zone(gfp_mask);
3650 struct scan_control sc = { 3651 struct scan_control sc = {
3651 .nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX), 3652 .nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX),
3652 .gfp_mask = (gfp_mask = memalloc_noio_flags(gfp_mask)), 3653 .gfp_mask = (gfp_mask = memalloc_noio_flags(gfp_mask)),
3653 .order = order, 3654 .order = order,
3654 .priority = ZONE_RECLAIM_PRIORITY, 3655 .priority = NODE_RECLAIM_PRIORITY,
3655 .may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE), 3656 .may_writepage = !!(node_reclaim_mode & RECLAIM_WRITE),
3656 .may_unmap = !!(zone_reclaim_mode & RECLAIM_UNMAP), 3657 .may_unmap = !!(node_reclaim_mode & RECLAIM_UNMAP),
3657 .may_swap = 1, 3658 .may_swap = 1,
3658 .reclaim_idx = zone_idx(zone), 3659 .reclaim_idx = classzone_idx,
3659 }; 3660 };
3660 3661
3661 cond_resched(); 3662 cond_resched();
@@ -3669,13 +3670,13 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
3669 reclaim_state.reclaimed_slab = 0; 3670 reclaim_state.reclaimed_slab = 0;
3670 p->reclaim_state = &reclaim_state; 3671 p->reclaim_state = &reclaim_state;
3671 3672
3672 if (zone_pagecache_reclaimable(zone) > zone->min_unmapped_pages) { 3673 if (node_pagecache_reclaimable(pgdat) > pgdat->min_unmapped_pages) {
3673 /* 3674 /*
3674 * Free memory by calling shrink zone with increasing 3675 * Free memory by calling shrink zone with increasing
3675 * priorities until we have enough memory freed. 3676 * priorities until we have enough memory freed.
3676 */ 3677 */
3677 do { 3678 do {
3678 shrink_node(zone->zone_pgdat, &sc, zone_idx(zone)); 3679 shrink_node(pgdat, &sc, classzone_idx);
3679 } while (sc.nr_reclaimed < nr_pages && --sc.priority >= 0); 3680 } while (sc.nr_reclaimed < nr_pages && --sc.priority >= 0);
3680 } 3681 }
3681 3682
@@ -3685,49 +3686,47 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
3685 return sc.nr_reclaimed >= nr_pages; 3686 return sc.nr_reclaimed >= nr_pages;
3686} 3687}
3687 3688
3688int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) 3689int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
3689{ 3690{
3690 int node_id;
3691 int ret; 3691 int ret;
3692 3692
3693 /* 3693 /*
3694 * Zone reclaim reclaims unmapped file backed pages and 3694 * Node reclaim reclaims unmapped file backed pages and
3695 * slab pages if we are over the defined limits. 3695 * slab pages if we are over the defined limits.
3696 * 3696 *
3697 * A small portion of unmapped file backed pages is needed for 3697 * A small portion of unmapped file backed pages is needed for
3698 * file I/O otherwise pages read by file I/O will be immediately 3698 * file I/O otherwise pages read by file I/O will be immediately
3699 * thrown out if the zone is overallocated. So we do not reclaim 3699 * thrown out if the node is overallocated. So we do not reclaim
3700 * if less than a specified percentage of the zone is used by 3700 * if less than a specified percentage of the node is used by
3701 * unmapped file backed pages. 3701 * unmapped file backed pages.
3702 */ 3702 */
3703 if (zone_pagecache_reclaimable(zone) <= zone->min_unmapped_pages && 3703 if (node_pagecache_reclaimable(pgdat) <= pgdat->min_unmapped_pages &&
3704 zone_page_state(zone, NR_SLAB_RECLAIMABLE) <= zone->min_slab_pages) 3704 sum_zone_node_page_state(pgdat->node_id, NR_SLAB_RECLAIMABLE) <= pgdat->min_slab_pages)
3705 return ZONE_RECLAIM_FULL; 3705 return NODE_RECLAIM_FULL;
3706 3706
3707 if (!pgdat_reclaimable(zone->zone_pgdat)) 3707 if (!pgdat_reclaimable(pgdat))
3708 return ZONE_RECLAIM_FULL; 3708 return NODE_RECLAIM_FULL;
3709 3709
3710 /* 3710 /*
3711 * Do not scan if the allocation should not be delayed. 3711 * Do not scan if the allocation should not be delayed.
3712 */ 3712 */
3713 if (!gfpflags_allow_blocking(gfp_mask) || (current->flags & PF_MEMALLOC)) 3713 if (!gfpflags_allow_blocking(gfp_mask) || (current->flags & PF_MEMALLOC))
3714 return ZONE_RECLAIM_NOSCAN; 3714 return NODE_RECLAIM_NOSCAN;
3715 3715
3716 /* 3716 /*
3717 * Only run zone reclaim on the local zone or on zones that do not 3717 * Only run node reclaim on the local node or on nodes that do not
3718 * have associated processors. This will favor the local processor 3718 * have associated processors. This will favor the local processor
3719 * over remote processors and spread off node memory allocations 3719 * over remote processors and spread off node memory allocations
3720 * as wide as possible. 3720 * as wide as possible.
3721 */ 3721 */
3722 node_id = zone_to_nid(zone); 3722 if (node_state(pgdat->node_id, N_CPU) && pgdat->node_id != numa_node_id())
3723 if (node_state(node_id, N_CPU) && node_id != numa_node_id()) 3723 return NODE_RECLAIM_NOSCAN;
3724 return ZONE_RECLAIM_NOSCAN;
3725 3724
3726 if (test_and_set_bit(ZONE_RECLAIM_LOCKED, &zone->flags)) 3725 if (test_and_set_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags))
3727 return ZONE_RECLAIM_NOSCAN; 3726 return NODE_RECLAIM_NOSCAN;
3728 3727
3729 ret = __zone_reclaim(zone, gfp_mask, order); 3728 ret = __node_reclaim(pgdat, gfp_mask, order);
3730 clear_bit(ZONE_RECLAIM_LOCKED, &zone->flags); 3729 clear_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags);
3731 3730
3732 if (!ret) 3731 if (!ret)
3733 count_vm_event(PGSCAN_ZONE_RECLAIM_FAILED); 3732 count_vm_event(PGSCAN_ZONE_RECLAIM_FAILED);