mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: David Hildenbrand <david@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Oscar Salvador <osalvador@suse.de>,
	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 v6 3/6] mm/page_alloc: add support for initializing pageblock as isolated.
Date: Fri, 30 May 2025 13:59:59 -0400	[thread overview]
Message-ID: <54E90DCD-0F18-4EA6-85A6-FBB5F3DEF95E@nvidia.com> (raw)
In-Reply-To: <4ff13fd3-3bfe-4c29-81dc-5e6c7aaa7af5@suse.cz>

On 30 May 2025, at 13:06, Vlastimil Babka wrote:

> On 5/30/25 18:22, Zi Yan wrote:
>> MIGRATE_ISOLATE is a standalone bit, so a pageblock cannot be initialized
>> to just MIGRATE_ISOLATE. Add init_pageblock_migratetype() to enable
>> initialize a pageblock with a migratetype and isolated.
>>
>> Signed-off-by: Zi Yan <ziy@nvidia.com>
>> Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
>
>> +void __meminit init_pageblock_migratetype(struct page *page,
>> +					  enum migratetype migratetype,
>> +					  bool isolate)
>> +{
>> +	unsigned long mask = MIGRATETYPE_MASK;
>> +	unsigned long flags = migratetype;
>> +
>> +	if (unlikely(page_group_by_mobility_disabled &&
>> +		     migratetype < MIGRATE_PCPTYPES))
>> +		migratetype = MIGRATE_UNMOVABLE;
>> +
>> +#ifdef CONFIG_MEMORY_ISOLATION
>> +	if (migratetype == MIGRATE_ISOLATE) {
>> +		VM_WARN_ONCE(
>> +			1,
>> +			"Set isolate=true to isolate pageblock with a migratetype");
>> +		return;
>> +	}
>> +	if (isolate) {
>> +		mask = MIGRATETYPE_AND_ISO_MASK;
>> +		flags |= BIT(PB_migrate_isolate);
>> +	}
>> +#endif
>> +	__set_pfnblock_flags_mask(page, page_to_pfn(page), flags, mask);
>
> Nit: I think this could have also used MIGRATETYPE_AND_ISO_MASK unconditionally?

This is the fixup:

From a701327561cc5d28ffccc66b7bfdabf87f32aa23 Mon Sep 17 00:00:00 2001
From: Zi Yan <ziy@nvidia.com>
Date: Fri, 30 May 2025 13:22:34 -0400
Subject: [PATCH] init_pageblock_migratetype() fixup.

Signed-off-by: Zi Yan <ziy@nvidia.com>
---
 mm/page_alloc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0284d74b6d8e..80bbfc47c9e9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -548,7 +548,6 @@ void __meminit init_pageblock_migratetype(struct page *page,
 					  enum migratetype migratetype,
 					  bool isolate)
 {
-	unsigned long mask = MIGRATETYPE_MASK;
 	unsigned long flags = migratetype;

 	if (unlikely(page_group_by_mobility_disabled &&
@@ -563,11 +562,11 @@ void __meminit init_pageblock_migratetype(struct page *page,
 		return;
 	}
 	if (isolate) {
-		mask = MIGRATETYPE_AND_ISO_MASK;
 		flags |= BIT(PB_migrate_isolate);
 	}
 #endif
-	__set_pfnblock_flags_mask(page, page_to_pfn(page), flags, mask);
+	__set_pfnblock_flags_mask(page, page_to_pfn(page), flags,
+				  MIGRATETYPE_AND_ISO_MASK);
 }

 #ifdef CONFIG_DEBUG_VM
-- 
2.47.2



Best Regards,
Yan, Zi

  parent reply	other threads:[~2025-05-30 18:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 16:22 [PATCH v6 0/6] Make MIGRATE_ISOLATE a standalone bit Zi Yan
2025-05-30 16:22 ` [PATCH v6 1/6] mm/page_alloc: pageblock flags functions clean up Zi Yan
2025-05-30 17:01   ` Vlastimil Babka
2025-05-30 19:39   ` David Hildenbrand
2025-05-30 16:22 ` [PATCH v6 2/6] mm/page_isolation: make page isolation a standalone bit Zi Yan
2025-05-30 17:04   ` Vlastimil Babka
2025-05-30 19:41   ` David Hildenbrand
2025-05-30 16:22 ` [PATCH v6 3/6] mm/page_alloc: add support for initializing pageblock as isolated Zi Yan
2025-05-30 17:06   ` Vlastimil Babka
2025-05-30 17:10     ` Zi Yan
2025-05-30 17:59     ` Zi Yan [this message]
2025-05-30 19:44   ` David Hildenbrand
2025-05-30 19:48     ` Zi Yan
2025-05-30 16:22 ` [PATCH v6 4/6] mm/page_isolation: remove migratetype from move_freepages_block_isolate() Zi Yan
2025-05-30 17:10   ` Vlastimil Babka
2025-05-30 19:52   ` David Hildenbrand
2025-05-30 19:54     ` Zi Yan
2025-05-30 16:22 ` [PATCH v6 5/6] mm/page_isolation: remove migratetype from undo_isolate_page_range() Zi Yan
2025-05-30 16:22 ` [PATCH v6 6/6] mm/page_isolation: remove migratetype parameter from more functions Zi Yan
2025-05-30 17:15   ` Vlastimil Babka
2025-05-30 17:21     ` Zi Yan
2025-05-30 18:01     ` Zi Yan
2025-05-30 19:56   ` David Hildenbrand
2025-05-30 19:58     ` Zi Yan
2025-05-30 20:08       ` David Hildenbrand
2025-05-30 20:46         ` Zi Yan
2025-05-30 20:55           ` David Hildenbrand
2025-06-02 14:18             ` Zi Yan
2025-06-02 16:25               ` David Hildenbrand
2025-06-02 16:27                 ` Zi Yan
2025-06-02 16:29                   ` David Hildenbrand

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=54E90DCD-0F18-4EA6-85A6-FBB5F3DEF95E@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

all inboxes | Powered by JetHome®