Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1465033 > unrolled thread
| Started by | Michal Hocko <mhocko@kernel.org> |
|---|---|
| First post | 2016-08-18 11:20 +0200 |
| Last post | 2016-08-18 12:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority Michal Hocko <mhocko@kernel.org> - 2016-08-18 11:20 +0200
Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority Vlastimil Babka <vbabka@suse.cz> - 2016-08-18 11:50 +0200
Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority Michal Hocko <mhocko@kernel.org> - 2016-08-18 12:00 +0200
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2016-08-18 11:20 +0200 |
| Subject | Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority |
| Message-ID | <s7rEt-6bL-15@gated-at.bofh.it> |
On Wed 10-08-16 11:12:21, Vlastimil Babka wrote:
> During reclaim/compaction loop, compaction priority can be increased by the
> should_compact_retry() function, but the current code is not optimal. Priority
> is only increased when compaction_failed() is true, which means that compaction
> has scanned the whole zone. This may not happen even after multiple attempts
> with a lower priority due to parallel activity, so we might needlessly
> struggle on the lower priorities and possibly run out of compaction retry
> attempts in the process.
>
> After this patch we are guaranteed at least one attempt at the highest
> compaction priority even if we exhaust all retries at the lower priorities.
I expect we will tend to do some special handling at the highest
priority so guaranteeing at least one run with that prio seems sensible to me. The only
question is whether we really want to enforce the highest priority for
costly orders as well. I think we want to reserve the highest (maybe add
one more) prio for !costly orders as those invoke the OOM killer and the
failure are quite disruptive.
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/page_alloc.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index fb975cec3518..b28517b918b0 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3155,13 +3155,8 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
> * so it doesn't really make much sense to retry except when the
> * failure could be caused by insufficient priority
> */
> - if (compaction_failed(compact_result)) {
> - if (*compact_priority > MIN_COMPACT_PRIORITY) {
> - (*compact_priority)--;
> - return true;
> - }
> - return false;
> - }
> + if (compaction_failed(compact_result))
> + goto check_priority;
>
> /*
> * make sure the compaction wasn't deferred or didn't bail out early
> @@ -3185,6 +3180,15 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
> if (compaction_retries <= max_retries)
> return true;
>
> + /*
> + * Make sure there is at least one attempt at the highest priority
> + * if we exhausted all retries at the lower priorities
> + */
> +check_priority:
> + if (*compact_priority > MIN_COMPACT_PRIORITY) {
> + (*compact_priority)--;
> + return true;
> + }
> return false;
> }
> #else
> --
> 2.9.2
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
[toc] | [next] | [standalone]
| From | Vlastimil Babka <vbabka@suse.cz> |
|---|---|
| Date | 2016-08-18 11:50 +0200 |
| Message-ID | <s7s7w-6mS-17@gated-at.bofh.it> |
| In reply to | #1465033 |
On 08/18/2016 11:10 AM, Michal Hocko wrote: > On Wed 10-08-16 11:12:21, Vlastimil Babka wrote: >> During reclaim/compaction loop, compaction priority can be increased by the >> should_compact_retry() function, but the current code is not optimal. Priority >> is only increased when compaction_failed() is true, which means that compaction >> has scanned the whole zone. This may not happen even after multiple attempts >> with a lower priority due to parallel activity, so we might needlessly >> struggle on the lower priorities and possibly run out of compaction retry >> attempts in the process. >> >> After this patch we are guaranteed at least one attempt at the highest >> compaction priority even if we exhaust all retries at the lower priorities. > > I expect we will tend to do some special handling at the highest > priority so guaranteeing at least one run with that prio seems sensible to me. The only > question is whether we really want to enforce the highest priority for > costly orders as well. I think we want to reserve the highest (maybe add > one more) prio for !costly orders as those invoke the OOM killer and the > failure are quite disruptive. Costly orders are already ruled out of reaching the highest priority unless they are __GFP_REPEAT, so I assumed that if they are allocations with __GFP_REPEAT, they really would like to succeed, so let them use the highest priority.
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2016-08-18 12:00 +0200 |
| Message-ID | <s7shc-6qu-5@gated-at.bofh.it> |
| In reply to | #1465053 |
On Thu 18-08-16 11:44:00, Vlastimil Babka wrote: > On 08/18/2016 11:10 AM, Michal Hocko wrote: > > On Wed 10-08-16 11:12:21, Vlastimil Babka wrote: > > > During reclaim/compaction loop, compaction priority can be increased by the > > > should_compact_retry() function, but the current code is not optimal. Priority > > > is only increased when compaction_failed() is true, which means that compaction > > > has scanned the whole zone. This may not happen even after multiple attempts > > > with a lower priority due to parallel activity, so we might needlessly > > > struggle on the lower priorities and possibly run out of compaction retry > > > attempts in the process. > > > > > > After this patch we are guaranteed at least one attempt at the highest > > > compaction priority even if we exhaust all retries at the lower priorities. > > > > I expect we will tend to do some special handling at the highest > > priority so guaranteeing at least one run with that prio seems sensible to me. The only > > question is whether we really want to enforce the highest priority for > > costly orders as well. I think we want to reserve the highest (maybe add > > one more) prio for !costly orders as those invoke the OOM killer and the > > failure are quite disruptive. > > Costly orders are already ruled out of reaching the highest priority unless > they are __GFP_REPEAT, so I assumed that if they are allocations with > __GFP_REPEAT, they really would like to succeed, so let them use the highest > priority. But even when __GFP_REPEAT is set then we do not want to be too aggressive. E.g. hugetlb pages are better to fail than the cause excessive reclaim or cause some long term fragmentation issues which might be a result of the skipped heuristics. costly orders are IMHO simply second class citizens even with they ask to try harder with __GFP_REPEAT. -- Michal Hocko SUSE Labs
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web