mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Kaitao Cheng <kaitao.cheng@linux.dev>,
	Vlastimil Babka <vbabka@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Brendan Jackman <jackmanb@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Liu Shixin <liushixin2@huawei.com>,
	David Hildenbrand <david@kernel.org>,
	Oscar Salvador <osalvador@suse.de>,
	muchun.song@linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Kaitao Cheng <chengkaitao@kylinos.cn>
Subject: Re: [PATCH v2] mm: page_isolation: avoid unsafe folio reads while scanning compound pages
Date: Tue, 02 Jun 2026 13:46:06 -0400	[thread overview]
Message-ID: <07E96104-E481-43E4-9ECC-5247A6CF4EE2@nvidia.com> (raw)
In-Reply-To: <20260602101147.2892436f68fd383723c39855@linux-foundation.org>

On 2 Jun 2026, at 13:11, Andrew Morton wrote:

> On Tue, 02 Jun 2026 11:02:41 -0400 Zi Yan <ziy@nvidia.com> wrote:
>
>>> -		*step = folio_nr_pages(folio) - folio_page_idx(folio, page);
>>> +		nr_pages = 1UL << order;
>>> +		pfn = page_to_pfn(page);
>>> +		*step = (pfn | (nr_pages - 1)) + 1 - pfn;
>>>  		return false;
>>>  	}
>>
>> LGTM. Thanks.
>>
>> Just a comment, order can be dropped and use
>> nr_pages = compound_nr(&folio->page) instead:
>> 1. order > MAX_FOLIO_ORDER -> nr_pages > MAX_FOLIO_NR_PAGES
>> 2. PAGE_SIZE << order -> PAGE_SIZE * nr_pages.
>> But it is not worth a new version.
>>
>> Reviewed-by: Zi Yan <ziy@nvidia.com>
>
> Thanks, I queued this.
>
> What are we to make of Sashiko's question?
> https://sashiko.dev/#/patchset/20260602130755.38794-1-kaitao.cheng@linux.dev

Sashiko asked if compound_order() returns bogus order and the code
can skip checking unmovable pages and return false negative (the
range has unmovable pages but returning false), leading to offline
in-use memory.

Answer is no. 1. order > MAX_FOLIO_ORDER restricts the number of
skipped pages; 2. the actual users of page_is_unmovable(), alloc_contig_range()
or hot offline, will perform page migration and unmovable pages
will fail the migration and prevent these users from doing
anything.

Best Regards,
Yan, Zi

  reply	other threads:[~2026-06-02 17:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 13:07 Kaitao Cheng
2026-06-02 15:02 ` Zi Yan
2026-06-02 17:11   ` Andrew Morton
2026-06-02 17:46     ` Zi Yan [this message]
2026-06-02 18:56   ` David Hildenbrand (Arm)
2026-06-02 19:31     ` Zi Yan
2026-06-02 19:37       ` David Hildenbrand (Arm)
2026-06-02 19:05 ` David Hildenbrand (Arm)
2026-06-03  5:35 ` Oscar Salvador (SUSE)
2026-06-11  7:52 ` Oscar Salvador (SUSE)

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=07E96104-E481-43E4-9ECC-5247A6CF4EE2@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=chengkaitao@kylinos.cn \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=kaitao.cheng@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liushixin2@huawei.com \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.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

all inboxes | Powered by JetHome®