lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54E90DCD-0F18-4EA6-85A6-FBB5F3DEF95E@nvidia.com>
Date: Fri, 30 May 2025 13:59:59 -0400
From: Zi Yan <ziy@...dia.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: David Hildenbrand <david@...hat.com>,
 Johannes Weiner <hannes@...xchg.org>, linux-mm@...ck.org,
 Andrew Morton <akpm@...ux-foundation.org>,
 Oscar Salvador <osalvador@...e.de>,
 Baolin Wang <baolin.wang@...ux.alibaba.com>,
 "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
 Mel Gorman <mgorman@...hsingularity.net>,
 Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
 Brendan Jackman <jackmanb@...gle.com>, Richard Chang <richardycc@...gle.com>,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 3/6] mm/page_alloc: add support for initializing
 pageblock as isolated.

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@...dia.com>
>> Reviewed-by: Vlastimil Babka <vbabka@...e.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@...dia.com>
Date: Fri, 30 May 2025 13:22:34 -0400
Subject: [PATCH] init_pageblock_migratetype() fixup.

Signed-off-by: Zi Yan <ziy@...dia.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ