Skip to contentSkip to conversation

mm-cma-move-put_page_testzero-out-of-vm_warn_on-in-cma_release.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Mar 4

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/cma: move put_page_testzero() out of VM_WARN_ON in cma_release()
has been removed from the -mm tree. Its filename was
mm-cma-move-put_page_testzero-out-of-vm_warn_on-in-cma_release.patch

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

------------------------------------------------------
From: Zi Yan <[email protected]>
Subject: mm/cma: move put_page_testzero() out of VM_WARN_ON in cma_release()
Date: Tue, 24 Feb 2026 22:12:31 -0500

When CONFIG_DEBUG_VM is not set, VM_WARN_ON is a NOP. Putting any statement with side effect inside it is incorrect. Collect all !put_page_testzero() results and check the sum using WARN instead after the loop. It restores the same check in free_contig_range() before commit e0c1326779cc ("mm: page_alloc: add alloc_contig_frozen_{range,pages}()"), the commit prior to the Fixes one.

---

 mm/cma.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
mm/cma.c renamed from mm/cma.c~mm-cma-move-put_page_testzero-out-of-vm_warn_on-in-cma_release +4 -1
@@ -1013,6 +1013,7 @@ bool cma_release(struct cma *cma, const
 		 unsigned long count)
 {
 	struct cma_memrange *cmr;
+	unsigned long ret = 0;
 	unsigned long i, pfn;
 
 	cmr = find_cma_memrange(cma, pages, count);
@@ -1021,7 +1022,9 @@ bool cma_release(struct cma *cma, const
 
 	pfn = page_to_pfn(pages);
 	for (i = 0; i < count; i++, pfn++)
-		VM_WARN_ON(!put_page_testzero(pfn_to_page(pfn)));
+		ret += !put_page_testzero(pfn_to_page(pfn));
+
+	WARN(ret, "%lu pages are still in use!\n", ret);
 
 	__cma_release_frozen(cma, cmr, pages, count);
 

_

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