diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2cb9eb71e282..4f95bcf0f2b1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1735,6 +1735,35 @@ zonelist_scan: | |||
1735 | if ((alloc_flags & ALLOC_CPUSET) && | 1735 | if ((alloc_flags & ALLOC_CPUSET) && |
1736 | !cpuset_zone_allowed_softwall(zone, gfp_mask)) | 1736 | !cpuset_zone_allowed_softwall(zone, gfp_mask)) |
1737 | continue; | 1737 | continue; |
1738 | /* | ||
1739 | * When allocating a page cache page for writing, we | ||
1740 | * want to get it from a zone that is within its dirty | ||
1741 | * limit, such that no single zone holds more than its | ||
1742 | * proportional share of globally allowed dirty pages. | ||
1743 | * The dirty limits take into account the zone's | ||
1744 | * lowmem reserves and high watermark so that kswapd | ||
1745 | * should be able to balance it without having to | ||
1746 | * write pages from its LRU list. | ||
1747 | * | ||
1748 | * This may look like it could increase pressure on | ||
1749 | * lower zones by failing allocations in higher zones | ||
1750 | * before they are full. But the pages that do spill | ||
1751 | * over are limited as the lower zones are protected | ||
1752 | * by this very same mechanism. It should not become | ||
1753 | * a practical burden to them. | ||
1754 | * | ||
1755 | * XXX: For now, allow allocations to potentially | ||
1756 | * exceed the per-zone dirty limit in the slowpath | ||
1757 | * (ALLOC_WMARK_LOW unset) before going into reclaim, | ||
1758 | * which is important when on a NUMA setup the allowed | ||
1759 | * zones are together not big enough to reach the | ||
1760 | * global limit. The proper fix for these situations | ||
1761 | * will require awareness of zones in the | ||
1762 | * dirty-throttling and the flusher threads. | ||
1763 | */ | ||
1764 | if ((alloc_flags & ALLOC_WMARK_LOW) && | ||
1765 | (gfp_mask & __GFP_WRITE) && !zone_dirty_ok(zone)) | ||
1766 | goto this_zone_full; | ||
1738 | 1767 | ||
1739 | BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); | 1768 | BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); |
1740 | if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { | 1769 | if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { |