diff options
-rw-r--r-- | mm/page_alloc.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4e8985acdab..6913854fd3e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1664,7 +1664,7 @@ zonelist_scan: | |||
1664 | continue; | 1664 | continue; |
1665 | if ((alloc_flags & ALLOC_CPUSET) && | 1665 | if ((alloc_flags & ALLOC_CPUSET) && |
1666 | !cpuset_zone_allowed_softwall(zone, gfp_mask)) | 1666 | !cpuset_zone_allowed_softwall(zone, gfp_mask)) |
1667 | goto try_next_zone; | 1667 | continue; |
1668 | 1668 | ||
1669 | BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); | 1669 | BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); |
1670 | if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { | 1670 | if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { |
@@ -1676,17 +1676,36 @@ zonelist_scan: | |||
1676 | classzone_idx, alloc_flags)) | 1676 | classzone_idx, alloc_flags)) |
1677 | goto try_this_zone; | 1677 | goto try_this_zone; |
1678 | 1678 | ||
1679 | if (NUMA_BUILD && !did_zlc_setup && nr_online_nodes > 1) { | ||
1680 | /* | ||
1681 | * we do zlc_setup if there are multiple nodes | ||
1682 | * and before considering the first zone allowed | ||
1683 | * by the cpuset. | ||
1684 | */ | ||
1685 | allowednodes = zlc_setup(zonelist, alloc_flags); | ||
1686 | zlc_active = 1; | ||
1687 | did_zlc_setup = 1; | ||
1688 | } | ||
1689 | |||
1679 | if (zone_reclaim_mode == 0) | 1690 | if (zone_reclaim_mode == 0) |
1680 | goto this_zone_full; | 1691 | goto this_zone_full; |
1681 | 1692 | ||
1693 | /* | ||
1694 | * As we may have just activated ZLC, check if the first | ||
1695 | * eligible zone has failed zone_reclaim recently. | ||
1696 | */ | ||
1697 | if (NUMA_BUILD && zlc_active && | ||
1698 | !zlc_zone_worth_trying(zonelist, z, allowednodes)) | ||
1699 | continue; | ||
1700 | |||
1682 | ret = zone_reclaim(zone, gfp_mask, order); | 1701 | ret = zone_reclaim(zone, gfp_mask, order); |
1683 | switch (ret) { | 1702 | switch (ret) { |
1684 | case ZONE_RECLAIM_NOSCAN: | 1703 | case ZONE_RECLAIM_NOSCAN: |
1685 | /* did not scan */ | 1704 | /* did not scan */ |
1686 | goto try_next_zone; | 1705 | continue; |
1687 | case ZONE_RECLAIM_FULL: | 1706 | case ZONE_RECLAIM_FULL: |
1688 | /* scanned but unreclaimable */ | 1707 | /* scanned but unreclaimable */ |
1689 | goto this_zone_full; | 1708 | continue; |
1690 | default: | 1709 | default: |
1691 | /* did we reclaim enough */ | 1710 | /* did we reclaim enough */ |
1692 | if (!zone_watermark_ok(zone, order, mark, | 1711 | if (!zone_watermark_ok(zone, order, mark, |
@@ -1703,16 +1722,6 @@ try_this_zone: | |||
1703 | this_zone_full: | 1722 | this_zone_full: |
1704 | if (NUMA_BUILD) | 1723 | if (NUMA_BUILD) |
1705 | zlc_mark_zone_full(zonelist, z); | 1724 | zlc_mark_zone_full(zonelist, z); |
1706 | try_next_zone: | ||
1707 | if (NUMA_BUILD && !did_zlc_setup && nr_online_nodes > 1) { | ||
1708 | /* | ||
1709 | * we do zlc_setup after the first zone is tried but only | ||
1710 | * if there are multiple nodes make it worthwhile | ||
1711 | */ | ||
1712 | allowednodes = zlc_setup(zonelist, alloc_flags); | ||
1713 | zlc_active = 1; | ||
1714 | did_zlc_setup = 1; | ||
1715 | } | ||
1716 | } | 1725 | } |
1717 | 1726 | ||
1718 | if (unlikely(NUMA_BUILD && page == NULL && zlc_active)) { | 1727 | if (unlikely(NUMA_BUILD && page == NULL && zlc_active)) { |