diff options
| -rw-r--r-- | mm/page_alloc.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 62d1ea3f2f5a..6903b695ebae 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
| @@ -3604,6 +3604,17 @@ retry: | |||
| 3604 | */ | 3604 | */ |
| 3605 | alloc_flags = gfp_to_alloc_flags(gfp_mask); | 3605 | alloc_flags = gfp_to_alloc_flags(gfp_mask); |
| 3606 | 3606 | ||
| 3607 | /* | ||
| 3608 | * Reset the zonelist iterators if memory policies can be ignored. | ||
| 3609 | * These allocations are high priority and system rather than user | ||
| 3610 | * orientated. | ||
| 3611 | */ | ||
| 3612 | if ((alloc_flags & ALLOC_NO_WATERMARKS) || !(alloc_flags & ALLOC_CPUSET)) { | ||
| 3613 | ac->zonelist = node_zonelist(numa_node_id(), gfp_mask); | ||
| 3614 | ac->preferred_zoneref = first_zones_zonelist(ac->zonelist, | ||
| 3615 | ac->high_zoneidx, ac->nodemask); | ||
| 3616 | } | ||
| 3617 | |||
| 3607 | /* This is the last chance, in general, before the goto nopage. */ | 3618 | /* This is the last chance, in general, before the goto nopage. */ |
| 3608 | page = get_page_from_freelist(gfp_mask, order, | 3619 | page = get_page_from_freelist(gfp_mask, order, |
| 3609 | alloc_flags & ~ALLOC_NO_WATERMARKS, ac); | 3620 | alloc_flags & ~ALLOC_NO_WATERMARKS, ac); |
| @@ -3612,12 +3623,6 @@ retry: | |||
| 3612 | 3623 | ||
| 3613 | /* Allocate without watermarks if the context allows */ | 3624 | /* Allocate without watermarks if the context allows */ |
| 3614 | if (alloc_flags & ALLOC_NO_WATERMARKS) { | 3625 | if (alloc_flags & ALLOC_NO_WATERMARKS) { |
| 3615 | /* | ||
| 3616 | * Ignore mempolicies if ALLOC_NO_WATERMARKS on the grounds | ||
| 3617 | * the allocation is high priority and these type of | ||
| 3618 | * allocations are system rather than user orientated | ||
| 3619 | */ | ||
| 3620 | ac->zonelist = node_zonelist(numa_node_id(), gfp_mask); | ||
| 3621 | page = get_page_from_freelist(gfp_mask, order, | 3626 | page = get_page_from_freelist(gfp_mask, order, |
| 3622 | ALLOC_NO_WATERMARKS, ac); | 3627 | ALLOC_NO_WATERMARKS, ac); |
| 3623 | if (page) | 3628 | if (page) |
| @@ -3816,7 +3821,11 @@ retry_cpuset: | |||
| 3816 | /* Dirty zone balancing only done in the fast path */ | 3821 | /* Dirty zone balancing only done in the fast path */ |
| 3817 | ac.spread_dirty_pages = (gfp_mask & __GFP_WRITE); | 3822 | ac.spread_dirty_pages = (gfp_mask & __GFP_WRITE); |
| 3818 | 3823 | ||
| 3819 | /* The preferred zone is used for statistics later */ | 3824 | /* |
| 3825 | * The preferred zone is used for statistics but crucially it is | ||
| 3826 | * also used as the starting point for the zonelist iterator. It | ||
| 3827 | * may get reset for allocations that ignore memory policies. | ||
| 3828 | */ | ||
| 3820 | ac.preferred_zoneref = first_zones_zonelist(ac.zonelist, | 3829 | ac.preferred_zoneref = first_zones_zonelist(ac.zonelist, |
| 3821 | ac.high_zoneidx, ac.nodemask); | 3830 | ac.high_zoneidx, ac.nodemask); |
| 3822 | if (!ac.preferred_zoneref) { | 3831 | if (!ac.preferred_zoneref) { |
