linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: David Hildenbrand <david@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	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 v7 6/6] mm/page_isolation: remove migratetype parameter from more functions.
Date: Mon, 02 Jun 2025 17:09:15 -0400	[thread overview]
Message-ID: <8297D7ED-2220-469A-922D-98C5E5B7671C@nvidia.com> (raw)
In-Reply-To: <1f1f1d26-5bbf-498a-b6af-0fb51fb3d50f@redhat.com>

On 2 Jun 2025, at 16:59, David Hildenbrand wrote:

> On 02.06.25 18:59, Zi Yan wrote:
>> On 2 Jun 2025, at 11:18, Zi Yan wrote:
>>
>>> migratetype is no longer overwritten during pageblock isolation,
>>> start_isolate_page_range(), has_unmovable_pages(), and
>>> set_migratetype_isolate() no longer need which migratetype to restore
>>> during isolation failure.
>>>
>>> For has_unmoable_pages(), it needs to know if the isolation is for CMA
>>> allocation, so adding PB_ISOLATE_MODE_CMA_ALLOC provide the information.
>>> At the same time change isolation flags to enum pb_isolate_mode
>>> (PB_ISOLATE_MODE_MEM_OFFLINE, PB_ISOLATE_MODE_CMA_ALLOC,
>>> PB_ISOLATE_MODE_OTHER). Remove REPORT_FAILURE and check
>>> PB_ISOLATE_MODE_MEM_OFFLINE, since only PB_ISOLATE_MODE_MEM_OFFLINE
>>> reports isolation failures.
>>>
>>> alloc_contig_range() no longer needs migratetype. Replace it with
>>> PB_ISOLATE_MODE_CMA_ALLOC to tell if an allocation is for CMA. So does
>>> __alloc_contig_migrate_range().
>>
>> This paragraph should be changed to:
>>
>> alloc_contig_range() no longer needs migratetype. Replace it with
>> a newly defined acr_flags_t to tell if an allocation is for CMA. So does
>> __alloc_contig_migrate_range(). Add ACR_OTHER (set to 0) to indicate
>> other cases.
>>

<snip>

>> +
>> +typedef unsigned int __bitwise acr_flags_t;
>> +#define ACR_OTHER	((__force acr_flags_t)0)	// other allocations
>> +#define ACR_CMA		((__force acr_flags_t)BIT(0))	// allocate for CMA
>
> For FPI I called that "FPI_NONE" -- no special request -- and similarly for RMAP "RMAP_NONE".
>
> So if ACR_CMA is set, it's a CMA allocation, otherwise just an ordinary one.
>
>
> Apart from that LGTM.

Make sense. Thanks. This is the rename fixup.

From ba6ff91746640e5baccbf55a48f9290a04ec1363 Mon Sep 17 00:00:00 2001
From: Zi Yan <ziy@nvidia.com>
Date: Mon, 2 Jun 2025 17:05:19 -0400
Subject: [PATCH] rename ACR_OTHER to ACR_NONE.

Signed-off-by: Zi Yan <ziy@nvidia.com>
---
 drivers/virtio/virtio_mem.c | 2 +-
 include/linux/gfp.h         | 2 +-
 mm/page_alloc.c             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
index 6bce70b139b2..42ebaafb9591 100644
--- a/drivers/virtio/virtio_mem.c
+++ b/drivers/virtio/virtio_mem.c
@@ -1243,7 +1243,7 @@ static int virtio_mem_fake_offline(struct virtio_mem *vm, unsigned long pfn,
 		if (atomic_read(&vm->config_changed))
 			return -EAGAIN;

-		rc = alloc_contig_range(pfn, pfn + nr_pages, ACR_OTHER,
+		rc = alloc_contig_range(pfn, pfn + nr_pages, ACR_NONE,
 					GFP_KERNEL);
 		if (rc == -ENOMEM)
 			/* whoops, out of memory */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 95065cec85e5..ccf35cc351ff 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -425,7 +425,7 @@ extern gfp_t vma_thp_gfp_mask(struct vm_area_struct *vma);
 #ifdef CONFIG_CONTIG_ALLOC

 typedef unsigned int __bitwise acr_flags_t;
-#define ACR_OTHER	((__force acr_flags_t)0)	// other allocations
+#define ACR_NONE	((__force acr_flags_t)0)	// ordinary allocation request
 #define ACR_CMA		((__force acr_flags_t)BIT(0))	// allocate for CMA

 /* The below functions must be run on a range from a single zone. */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c12442fdb579..0867e2b2e187 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6997,7 +6997,7 @@ static int __alloc_contig_pages(unsigned long start_pfn,
 {
 	unsigned long end_pfn = start_pfn + nr_pages;

-	return alloc_contig_range_noprof(start_pfn, end_pfn, ACR_OTHER,
+	return alloc_contig_range_noprof(start_pfn, end_pfn, ACR_NONE,
 					 gfp_mask);
 }

-- 
2.47.2



Best Regards,
Yan, Zi


      reply	other threads:[~2025-06-02 21:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02 15:18 [PATCH v7 0/6] Make MIGRATE_ISOLATE a standalone bit Zi Yan
2025-06-02 15:18 ` [PATCH v7 1/6] mm/page_alloc: pageblock flags functions clean up Zi Yan
2025-06-02 15:18 ` [PATCH v7 2/6] mm/page_isolation: make page isolation a standalone bit Zi Yan
2025-06-02 15:18 ` [PATCH v7 3/6] mm/page_alloc: add support for initializing pageblock as isolated Zi Yan
2025-06-02 15:18 ` [PATCH v7 4/6] mm/page_isolation: remove migratetype from move_freepages_block_isolate() Zi Yan
2025-06-02 15:18 ` [PATCH v7 5/6] mm/page_isolation: remove migratetype from undo_isolate_page_range() Zi Yan
2025-06-02 15:18 ` [PATCH v7 6/6] mm/page_isolation: remove migratetype parameter from more functions Zi Yan
2025-06-02 16:59   ` Zi Yan
2025-06-02 20:59     ` David Hildenbrand
2025-06-02 21:09       ` Zi Yan [this message]

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=8297D7ED-2220-469A-922D-98C5E5B7671C@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