linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Johannes Weiner <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>,
	linux-mm@kvack.org, Oscar Salvador <osalvador@suse.de>,
	Vlastimil Babka <vbabka@suse.cz>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Brendan Jackman <jackmanb@google.com>,
	Richard Chang <richardycc@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/4] mm/page_isolation: make page isolation a standalone bit.
Date: Thu, 08 May 2025 16:53:37 -0400	[thread overview]
Message-ID: <10C2C1DD-A6E2-4745-8C2E-D09886F4104E@nvidia.com> (raw)
In-Reply-To: <20250508204644.GB323143@cmpxchg.org>

On 8 May 2025, at 16:46, Johannes Weiner wrote:

> On Thu, May 08, 2025 at 03:17:05PM -0400, Zi Yan wrote:
>>
>>>>> @@ -426,7 +460,12 @@ void set_pageblock_migratetype(struct page *page, int migratetype)
>>>>>  		     migratetype < MIGRATE_PCPTYPES))
>>>>>  		migratetype = MIGRATE_UNMOVABLE;
>>>>>
>>>>> -	set_pfnblock_flags_mask(page, (unsigned long)migratetype,
>>>>> +#ifdef CONFIG_MEMORY_ISOLATION
>>>>> +	if (migratetype == MIGRATE_ISOLATE)
>>>>> +		set_pageblock_isolate(page);
>>>>
>>>> Are there paths actually doing this after the second patch?
>>>>
>>>> There are many instances that want to *read* the migratetype or
>>>> MIGRATE_ISOLATE, but only isolation code should be manipulating that
>>>> bit through the dedicated set/toggle_pageblock_isolate API.
>>>>
>>>> If there isn't one, it might be good to enforce this with a VM_WARN
>>>> instead.
>>>
>>> I checked all set_pageblock_migratetype() callers and do not see
>>> one using it for pageblock isolation. Let me replace the code
>>> with a VM_WARN and add a comment to tell users to use dedicated
>>> pageblock isolation APIs.
>>>
>>
>> Actually, move_freepages_block_isolate() calls __move_freepages_block()
>> to move free pages to MIGRATE_ISOLATE pageblock and
>> set_pageblock_migratetype() is used inside __move_freepages_block().
>> So the branch has to stay. Will use the suggestion below.
>
> Ah, good catch. But looking at the callers, it's:
>
> move_freepages_block()
> move_freepages_block_isolate()
> try_to_claim_block()
>
> The last one would benefit from having the set_pageblock_migratetype()
> there explicitly, as this is what this function is supposed to do. It
> also should never set the isolation bit.
>
> move_freepages_block_isolate() has two set_pageblock_migratetype()
> calls already. And after the series, it should only manipulate the
> isolate bit, not change the actual migratetype anymore, right?
>
> Maybe it makes the most sense to move it into the three callers?
>
> And then fortify set_pageblock_migratetype() after all.

Sounds good to me. Let me update my fixups.

Hi Andrew,

I will resend new fixups based on Johannes' comment.

--
Best Regards,
Yan, Zi


  reply	other threads:[~2025-05-08 20:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 21:10 [PATCH v3 0/4] Make MIGRATE_ISOLATE " Zi Yan
2025-05-07 21:10 ` [PATCH v3 1/4] mm/page_isolation: make page isolation " Zi Yan
2025-05-08  5:24   ` Johannes Weiner
2025-05-08 15:27     ` Zi Yan
2025-05-08 19:17       ` Zi Yan
2025-05-08 20:46         ` Johannes Weiner
2025-05-08 20:53           ` Zi Yan [this message]
2025-05-09  1:33             ` Zi Yan
2025-05-09 12:48               ` Zi Yan
2025-05-08 20:22   ` Zi Yan
2025-05-08 21:13     ` Johannes Weiner
2025-05-09 13:57     ` Zi Yan
2025-05-07 21:10 ` [PATCH v3 2/4] mm/page_isolation: remove migratetype from move_freepages_block_isolate() Zi Yan
2025-05-08 20:23   ` Zi Yan
2025-05-07 21:10 ` [PATCH v3 3/4] mm/page_isolation: remove migratetype from undo_isolate_page_range() Zi Yan
2025-05-08 21:12   ` Johannes Weiner
2025-05-07 21:10 ` [PATCH v3 4/4] mm/page_isolation: remove migratetype parameter from more functions Zi Yan
2025-05-08 20:25   ` Zi Yan
2025-05-09  1:56     ` Zi Yan
2025-05-09 16:01       ` Zi Yan
2025-05-08 21:11   ` Johannes Weiner
2025-05-08 22:15     ` Zi Yan
2025-05-08  4:38 ` [PATCH v3 0/4] Make MIGRATE_ISOLATE a standalone bit Johannes Weiner

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=10C2C1DD-A6E2-4745-8C2E-D09886F4104E@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=richardycc@google.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    /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