Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1463423 > unrolled thread

Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority

Started byJoonsoo Kim <iamjoonsoo.kim@lge.com>
First post2016-08-16 08:10 +0200
Last post2016-08-16 08:40 +0200
Articles 2 — 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.


Contents

  Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct  compaction priority Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-08-16 08:10 +0200
    Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct  compaction priority Vlastimil Babka <vbabka@suse.cz> - 2016-08-16 08:40 +0200

#1463423 — Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority

FromJoonsoo Kim <iamjoonsoo.kim@lge.com>
Date2016-08-16 08:10 +0200
SubjectRe: [PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority
Message-ID<s6FJv-7Qq-3@gated-at.bofh.it>
On Wed, Aug 10, 2016 at 11:12:21AM +0200, 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.

The only difference that this patch makes is increasing priority when
COMPACT_PARTIAL(COMPACTION_SUCCESS) returns. In that case, we can
usually allocate high-order freepage so we would not enter here. Am I
missing something? Is it really needed behaviour change?

Thanks.

> 
> 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;

The only difference that this patch makes is increasing priority when
COMPACT_PARTIAL(COMPACTION_SUCCESS) returns. In that case, we can
usually allocate high-order freepage so we would not enter here. Am I
missing something? Is it really needed behaviour change?

Thanks.

[toc] | [next] | [standalone]


#1463452

FromVlastimil Babka <vbabka@suse.cz>
Date2016-08-16 08:40 +0200
Message-ID<s6Gcy-80i-7@gated-at.bofh.it>
In reply to#1463423
On 08/16/2016 08:07 AM, Joonsoo Kim wrote:
>> 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;
>
> The only difference that this patch makes is increasing priority when
> COMPACT_PARTIAL(COMPACTION_SUCCESS) returns. In that case, we can

Hm it's true that I adjusted this patch from the previous version, 
before realizing that PARTIAL is now SUCCESS.

> usually allocate high-order freepage so we would not enter here. Am I
> missing something? Is it really needed behaviour change?

It will likely be rare when this triggers, when compaction success 
doesn't lead to allocation success due to parallel allocation activity.

> Thanks.
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web