linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, jgowans@amazon.com,
	yuzhao@google.com
Subject: Re: [PATCH -next 1/2] mm: compaction: convert to use a folio in isolate_migratepages_block()
Date: Mon, 12 Jun 2023 15:41:12 +0100	[thread overview]
Message-ID: <ZIcuiHIXsIXKHGFH@casper.infradead.org> (raw)
In-Reply-To: <20230612143414.186389-1-wangkefeng.wang@huawei.com>

On Mon, Jun 12, 2023 at 10:34:13PM +0800, Kefeng Wang wrote:
> @@ -959,7 +960,8 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  				 * Hugepage was successfully isolated and placed
>  				 * on the cc->migratepages list.
>  				 */
> -				low_pfn += compound_nr(page) - 1;
> +				folio = page_folio(page);
> +				low_pfn += folio_nr_pages(folio) - 1;
>  				goto isolate_success_no_list;

Why is this safe?  That is, how do we know that the folio can't be
dissolved under us at this point, then reallocated and hit the
VM_BUG_ON_PGFLAGS(PageTail(page), page) in folio_flags() when we
test folio_test_large()?

> @@ -1132,30 +1137,30 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  			 * and it's on LRU. It can only be a THP so the order
>  			 * is safe to read and it's 0 for tail pages.
>  			 */

^^^ This comment needs to be updated too.

> -		mod_node_page_state(page_pgdat(page),
> -				NR_ISOLATED_ANON + page_is_file_lru(page),
> -				thp_nr_pages(page));
> +		lruvec_del_folio(lruvec, folio);
> +		mod_node_page_state(folio_pgdat(folio),
> +				NR_ISOLATED_ANON + folio_is_file_lru(folio),
> +				folio_nr_pages(folio));

		node_stat_mod_folio()



  parent reply	other threads:[~2023-06-12 14:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 14:34 Kefeng Wang
2023-06-12 14:34 ` [PATCH -next 2/2] mm: kill [add|del]_page_to_lru_list() Kefeng Wang
2023-06-12 19:10   ` Yu Zhao
2023-06-12 14:41 ` Matthew Wilcox [this message]
2023-06-13  1:53   ` [PATCH -next 1/2] mm: compaction: convert to use a folio in isolate_migratepages_block() Kefeng Wang
2023-06-14 11:21     ` Kefeng 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=ZIcuiHIXsIXKHGFH@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=jgowans@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=yuzhao@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox