linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Kemeng Shi <shikemeng@huaweicloud.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org
Cc: mgorman@techsingularity.net, willy@infradead.org, david@redhat.com
Subject: Re: [PATCH 4/5] mm/compaction: remove unnecessary cursor page in isolate_freepages_block
Date: Wed, 2 Aug 2023 10:59:32 +0800	[thread overview]
Message-ID: <b51e710a-ab9a-78b5-59fc-6ed9bcd27269@linux.alibaba.com> (raw)
In-Reply-To: <20230729174354.2239980-5-shikemeng@huaweicloud.com>



On 7/30/2023 1:43 AM, Kemeng Shi wrote:
> The cursor is only used for page forward currently. We can simply move page
> forward directly to remove unnecessary cursor.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
>   mm/compaction.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 65791a74c5e8..cfb661f4ce23 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -589,7 +589,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
>   				bool strict)
>   {
>   	int nr_scanned = 0, total_isolated = 0;
> -	struct page *cursor;
> +	struct page *page;
>   	unsigned long flags = 0;
>   	spinlock_t *locked = NULL;
>   	unsigned long blockpfn = *start_pfn;
> @@ -599,12 +599,11 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
>   	if (strict)
>   		stride = 1;
>   
> -	cursor = pfn_to_page(blockpfn);
> +	page = pfn_to_page(blockpfn);
>   
>   	/* Isolate free pages. */
> -	for (; blockpfn < end_pfn; blockpfn += stride, cursor += stride) {
> +	for (; blockpfn < end_pfn; blockpfn += stride, page += stride) {
>   		int isolated;
> -		struct page *page = cursor;
>   
>   		/*
>   		 * Periodically drop the lock (if held) regardless of its
> @@ -628,7 +627,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
>   
>   			if (likely(order <= MAX_ORDER)) {
>   				blockpfn += (1UL << order) - 1;
> -				cursor += (1UL << order) - 1;
> +				page += (1UL << order) - 1;
>   				nr_scanned += (1UL << order) - 1;
>   			}
>   			goto isolate_fail;
> @@ -665,7 +664,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
>   		}
>   		/* Advance to the end of split page */
>   		blockpfn += isolated - 1;
> -		cursor += isolated - 1;
> +		page += isolated - 1;
>   		continue;
>   
>   isolate_fail:


  reply	other threads:[~2023-08-02  2:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-29 17:43 [PATCH 0/5] Fixes and cleanups to compaction Kemeng Shi
2023-07-29 17:43 ` [PATCH 1/5] mm/compaction: allow blockpfn outside of pageblock for high order buddy page Kemeng Shi
2023-08-01 19:12   ` Andrew Morton
2023-08-02  1:57   ` Baolin Wang
2023-08-02  6:01     ` Kemeng Shi
2023-07-29 17:43 ` [PATCH 4/5] mm/compaction: remove unnecessary cursor page in isolate_freepages_block Kemeng Shi
2023-08-02  2:59   ` Baolin Wang [this message]
     [not found] ` <20230729174354.2239980-3-shikemeng@huaweicloud.com>
2023-08-02  2:32   ` [PATCH 2/5] mm/compaction: set compact_cached_free_pfn correctly in update_pageblock_skip Baolin Wang
     [not found] ` <20230729174354.2239980-4-shikemeng@huaweicloud.com>
2023-08-02  2:56   ` [PATCH 3/5] mm/compaction: merge end_pfn boundary check in isolate_freepages_range Baolin Wang
     [not found] ` <20230729174354.2239980-6-shikemeng@huaweicloud.com>
2023-08-02  3:00   ` [PATCH 5/5] mm/compaction: remove unnecessary "else continue" at end of loop in isolate_freepages_block Baolin Wang

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=b51e710a-ab9a-78b5-59fc-6ed9bcd27269@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=shikemeng@huaweicloud.com \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox