Skip to contentSkip to conversation

powernv-memtrace-use-__gfp_zero-with-alloc_contig_pages.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jan 14, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: powernv/memtrace: use __GFP_ZERO with alloc_contig_pages()
has been removed from the -mm tree. Its filename was
powernv-memtrace-use-__gfp_zero-with-alloc_contig_pages.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: David Hildenbrand <[email protected]>
Subject: powernv/memtrace: use __GFP_ZERO with alloc_contig_pages()
Date: Tue, 3 Dec 2024 10:47:32 +0100

alloc_contig_pages()->alloc_contig_range() now supports __GFP_ZERO, so let's use that instead to resolve our TODO.

Cc Christophe Leroy <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Naveen N Rao <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Vishal Moola (Oracle) <[email protected]>
Cc Zi Yan <[email protected]>

---

 arch/powerpc/platforms/powernv/memtrace.c |   31 +++-----------------
 1 file changed, 6 insertions(+), 25 deletions(-)
arch/powerpc/platforms/powernv/memtrace.c renamed from arch/powerpc/platforms/powernv/memtrace.c~powernv-memtrace-use-__gfp_zero-with-alloc_contig_pages +6 -25
@@ -88,26 +88,6 @@ static void flush_dcache_range_chunked(u
 	}
 }
 
-static void memtrace_clear_range(unsigned long start_pfn,
-				 unsigned long nr_pages)
-{
-	unsigned long pfn;
-
-	/* As HIGHMEM does not apply, use clear_page() directly. */
-	for (pfn = start_pfn; pfn < start_pfn + nr_pages; pfn++) {
-		if (IS_ALIGNED(pfn, PAGES_PER_SECTION))
-			cond_resched();
-		clear_page(__va(PFN_PHYS(pfn)));
-	}
-	/*
-	 * Before we go ahead and use this range as cache inhibited range
-	 * flush the cache.
-	 */
-	flush_dcache_range_chunked((unsigned long)pfn_to_kaddr(start_pfn),
-				   (unsigned long)pfn_to_kaddr(start_pfn + nr_pages),
-				   FLUSH_CHUNK_SIZE);
-}
-
 static u64 memtrace_alloc_node(u32 nid, u64 size)
 {
 	const unsigned long nr_pages = PHYS_PFN(size);
@@ -119,17 +99,18 @@ static u64 memtrace_alloc_node(u32 nid,
 	 * by alloc_contig_pages().
 	 */
 	page = alloc_contig_pages(nr_pages, GFP_KERNEL | __GFP_THISNODE |
-				  __GFP_NOWARN, nid, NULL);
+				  __GFP_NOWARN | __GFP_ZERO, nid, NULL);
 	if (!page)
 		return 0;
 	start_pfn = page_to_pfn(page);
 
 	/*
-	 * Clear the range while we still have a linear mapping.
-	 *
-	 * TODO: use __GFP_ZERO with alloc_contig_pages() once supported.
+	 * Before we go ahead and use this range as cache inhibited range
+	 * flush the cache.
 	 */
-	memtrace_clear_range(start_pfn, nr_pages);
+	flush_dcache_range_chunked((unsigned long)pfn_to_kaddr(start_pfn),
+				   (unsigned long)pfn_to_kaddr(start_pfn + nr_pages),
+				   FLUSH_CHUNK_SIZE);
 
 	/*
 	 * Set pages PageOffline(), to indicate that nobody (e.g., hibernation,

_

Patches currently in -mm which might be from [email protected] are

mm-huge_memory-convert-has_hwpoisoned-into-a-pure-folio-flag.patch mm-hugetlb-rename-isolate_hugetlb-to-folio_isolate_hugetlb.patch mm-migrate-dont-call-folio_putback_active_hugetlb-on-dst-hugetlb-folio.patch mm-hugetlb-rename-folio_putback_active_hugetlb-to-folio_putback_hugetlb.patch mm-hugetlb-cgroup-convert-hugetlb_cgroup_css_offline-to-work-on-folios.patch mm-hugetlb-use-folio-lru-int-demote_free_hugetlb_folios.patch