All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: David Rientjes <rientjes@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Minchan Kim <minchan@kernel.org>,
	Michal Nazarewicz <mina86@mina86.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Christoph Lameter <cl@linux.com>, Rik van Riel <riel@redhat.com>,
	Mel Gorman <mgorman@suse.de>,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Subject: Re: [PATCH v2 for v3.18] mm/compaction: skip the range until proper target pageblock is met
Date: Tue, 04 Nov 2014 09:46:09 +0100	[thread overview]
Message-ID: <54589251.2020105@suse.cz> (raw)
In-Reply-To: <1415068649-18040-1-git-send-email-iamjoonsoo.kim@lge.com>

On 11/04/2014 03:37 AM, Joonsoo Kim wrote:
> commit 7d49d8868336 ("mm, compaction: reduce zone checking frequency in
> the migration scanner") makes side-effect that change iteration
> range calculation. Before change, block_end_pfn is calculated using
> start_pfn, but, now, blindly add pageblock_nr_pages to previous value.
>
> This cause the problem that isolation_start_pfn is larger than
> block_end_pfn when we isolate the page with more than pageblock order.
> In this case, isolation would be failed due to invalid range parameter.
>
> To prevent this, this patch recalculate the range to find valid target
> pageblock. Without this patch, CMA with more than pageblock order always
> fail, but, with this patch, it will succeed.
>
> Changes from v1:
> recalculate the range rather than just skipping to find valid one.
> add code comment.
>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

(nitpick below)

> ---
>   mm/compaction.c |   10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/mm/compaction.c b/mm/compaction.c
> index ec74cf0..4f0151c 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -479,6 +479,16 @@ isolate_freepages_range(struct compact_control *cc,
>
>   		block_end_pfn = min(block_end_pfn, end_pfn);
>
> +		/*
> +		 * pfn could pass the block_end_pfn if isolated freepage
> +		 * is more than pageblock order. In this case, we adjust
> +		 * scanning range to right one.
> +		 */
> +		if (pfn >= block_end_pfn) {
> +			block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
> +			block_end_pfn = min(block_end_pfn, end_pfn);
> +		}

If you moved this up, there could be just one min(block_end_pfn, 
end_pfn) instance in the code. If the first min() makes block_end_pfn == 
end_pfn and pfn >= block_end_pfn, then pfn >= end_pfn and the loop would 
be terminated already (assuming this was why you left the first min() 
before the new check). But I don't mind if you leave it like this.

> +
>   		if (!pageblock_pfn_to_page(pfn, block_end_pfn, cc->zone))
>   			break;
>
>

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

WARNING: multiple messages have this Message-ID (diff)
From: Vlastimil Babka <vbabka@suse.cz>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: David Rientjes <rientjes@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Minchan Kim <minchan@kernel.org>,
	Michal Nazarewicz <mina86@mina86.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Christoph Lameter <cl@linux.com>, Rik van Riel <riel@redhat.com>,
	Mel Gorman <mgorman@suse.de>,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Subject: Re: [PATCH v2 for v3.18] mm/compaction: skip the range until proper target pageblock is met
Date: Tue, 04 Nov 2014 09:46:09 +0100	[thread overview]
Message-ID: <54589251.2020105@suse.cz> (raw)
In-Reply-To: <1415068649-18040-1-git-send-email-iamjoonsoo.kim@lge.com>

On 11/04/2014 03:37 AM, Joonsoo Kim wrote:
> commit 7d49d8868336 ("mm, compaction: reduce zone checking frequency in
> the migration scanner") makes side-effect that change iteration
> range calculation. Before change, block_end_pfn is calculated using
> start_pfn, but, now, blindly add pageblock_nr_pages to previous value.
>
> This cause the problem that isolation_start_pfn is larger than
> block_end_pfn when we isolate the page with more than pageblock order.
> In this case, isolation would be failed due to invalid range parameter.
>
> To prevent this, this patch recalculate the range to find valid target
> pageblock. Without this patch, CMA with more than pageblock order always
> fail, but, with this patch, it will succeed.
>
> Changes from v1:
> recalculate the range rather than just skipping to find valid one.
> add code comment.
>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

(nitpick below)

> ---
>   mm/compaction.c |   10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/mm/compaction.c b/mm/compaction.c
> index ec74cf0..4f0151c 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -479,6 +479,16 @@ isolate_freepages_range(struct compact_control *cc,
>
>   		block_end_pfn = min(block_end_pfn, end_pfn);
>
> +		/*
> +		 * pfn could pass the block_end_pfn if isolated freepage
> +		 * is more than pageblock order. In this case, we adjust
> +		 * scanning range to right one.
> +		 */
> +		if (pfn >= block_end_pfn) {
> +			block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
> +			block_end_pfn = min(block_end_pfn, end_pfn);
> +		}

If you moved this up, there could be just one min(block_end_pfn, 
end_pfn) instance in the code. If the first min() makes block_end_pfn == 
end_pfn and pfn >= block_end_pfn, then pfn >= end_pfn and the loop would 
be terminated already (assuming this was why you left the first min() 
before the new check). But I don't mind if you leave it like this.

> +
>   		if (!pageblock_pfn_to_page(pfn, block_end_pfn, cc->zone))
>   			break;
>
>


  reply	other threads:[~2014-11-04  8:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04  2:37 [PATCH v2 for v3.18] mm/compaction: skip the range until proper target pageblock is met Joonsoo Kim
2014-11-04  2:37 ` Joonsoo Kim
2014-11-04  8:46 ` Vlastimil Babka [this message]
2014-11-04  8:46   ` Vlastimil Babka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54589251.2020105@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mina86@mina86.com \
    --cc=minchan@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=zhangyanfei@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.