diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2016-10-07 20:00:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-07 21:46:29 -0400 |
commit | 423b452e1553e3d19b632880bf2adf1f058ab267 (patch) | |
tree | 0bdea616f1b8155ca4c47aa3172e0eadc0540f60 /mm | |
parent | 9f7e3387939b036faacf4e7f32de7bb92a6635d6 (diff) |
mm, page_alloc: pull no_progress_loops update to should_reclaim_retry()
The should_reclaim_retry() makes decisions based on no_progress_loops,
so it makes sense to also update the counter there. It will be also
consistent with should_compact_retry() and compaction_retries. No
functional change.
[hillf.zj@alibaba-inc.com: fix missing pointer dereferences]
Link: http://lkml.kernel.org/r/20160926162025.21555-3-vbabka@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: David Rientjes <rientjes@google.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')
-rw-r--r-- | mm/page_alloc.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 891e3881a6e0..bcfa647c1752 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3402,16 +3402,26 @@ bool gfp_pfmemalloc_allowed(gfp_t gfp_mask) | |||
3402 | static inline bool | 3402 | static inline bool |
3403 | should_reclaim_retry(gfp_t gfp_mask, unsigned order, | 3403 | should_reclaim_retry(gfp_t gfp_mask, unsigned order, |
3404 | struct alloc_context *ac, int alloc_flags, | 3404 | struct alloc_context *ac, int alloc_flags, |
3405 | bool did_some_progress, int no_progress_loops) | 3405 | bool did_some_progress, int *no_progress_loops) |
3406 | { | 3406 | { |
3407 | struct zone *zone; | 3407 | struct zone *zone; |
3408 | struct zoneref *z; | 3408 | struct zoneref *z; |
3409 | 3409 | ||
3410 | /* | 3410 | /* |
3411 | * Costly allocations might have made a progress but this doesn't mean | ||
3412 | * their order will become available due to high fragmentation so | ||
3413 | * always increment the no progress counter for them | ||
3414 | */ | ||
3415 | if (did_some_progress && order <= PAGE_ALLOC_COSTLY_ORDER) | ||
3416 | *no_progress_loops = 0; | ||
3417 | else | ||
3418 | (*no_progress_loops)++; | ||
3419 | |||
3420 | /* | ||
3411 | * Make sure we converge to OOM if we cannot make any progress | 3421 | * Make sure we converge to OOM if we cannot make any progress |
3412 | * several times in the row. | 3422 | * several times in the row. |
3413 | */ | 3423 | */ |
3414 | if (no_progress_loops > MAX_RECLAIM_RETRIES) | 3424 | if (*no_progress_loops > MAX_RECLAIM_RETRIES) |
3415 | return false; | 3425 | return false; |
3416 | 3426 | ||
3417 | /* | 3427 | /* |
@@ -3426,7 +3436,7 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order, | |||
3426 | unsigned long reclaimable; | 3436 | unsigned long reclaimable; |
3427 | 3437 | ||
3428 | available = reclaimable = zone_reclaimable_pages(zone); | 3438 | available = reclaimable = zone_reclaimable_pages(zone); |
3429 | available -= DIV_ROUND_UP(no_progress_loops * available, | 3439 | available -= DIV_ROUND_UP((*no_progress_loops) * available, |
3430 | MAX_RECLAIM_RETRIES); | 3440 | MAX_RECLAIM_RETRIES); |
3431 | available += zone_page_state_snapshot(zone, NR_FREE_PAGES); | 3441 | available += zone_page_state_snapshot(zone, NR_FREE_PAGES); |
3432 | 3442 | ||
@@ -3642,18 +3652,8 @@ retry: | |||
3642 | if (order > PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_REPEAT)) | 3652 | if (order > PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_REPEAT)) |
3643 | goto nopage; | 3653 | goto nopage; |
3644 | 3654 | ||
3645 | /* | ||
3646 | * Costly allocations might have made a progress but this doesn't mean | ||
3647 | * their order will become available due to high fragmentation so | ||
3648 | * always increment the no progress counter for them | ||
3649 | */ | ||
3650 | if (did_some_progress && order <= PAGE_ALLOC_COSTLY_ORDER) | ||
3651 | no_progress_loops = 0; | ||
3652 | else | ||
3653 | no_progress_loops++; | ||
3654 | |||
3655 | if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, | 3655 | if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, |
3656 | did_some_progress > 0, no_progress_loops)) | 3656 | did_some_progress > 0, &no_progress_loops)) |
3657 | goto retry; | 3657 | goto retry; |
3658 | 3658 | ||
3659 | /* | 3659 | /* |