[OS-BUILD PATCH 2/2] mm/cma: print RHEL-specific warnings when CMA is first invoked

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: David Hildenbrand <david@xxxxxxxxxx>

mm/cma: print RHEL-specific warnings when CMA is first invoked

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1945002
Upstream: RHEL only

CMA is Tech Preview in RHEL 9; to detect the use of CMA easily, let's print
warninigs when
* Activating a CMA region succeeds
* cma_alloc() is called for the first time
* cma_release() is called for the first time

Print when cma_alloc()/cma_release() will actually do some work; for
example, cma_release() is sometimes called for memory regions even though
the memory isn't managed by CMA.

Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>

diff a/mm/cma.c b/mm/cma.c
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -125,6 +125,12 @@ static void __init cma_activate_area(struct cma *cma)
 	spin_lock_init(&cma->mem_head_lock);
 #endif
 
+#ifdef CONFIG_RHEL_DIFFERENCES
+	pr_warn("CMA area %s at [0x%llx-0x%llx] was activated\n", cma->name,
+		(unsigned long long)PFN_PHYS(cma->base_pfn),
+		(unsigned long long)PFN_PHYS(cma->base_pfn + cma->count) - 1);
+#endif /* CONFIG_RHEL_DIFFERENCES */
+
 	return;
 
 not_in_zone:
@@ -437,6 +443,10 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
 	if (!cma || !cma->count || !cma->bitmap)
 		return NULL;
 
+#ifdef CONFIG_RHEL_DIFFERENCES
+	pr_warn_once("%s() got called for the first time\n", __func__);
+#endif /* CONFIG_RHEL_DIFFERENCES */
+
 	pr_debug("%s(cma %p, count %zu, align %d)\n", __func__, (void *)cma,
 		 count, align);
 
@@ -533,6 +543,10 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count)
 	if (pfn < cma->base_pfn || pfn >= cma->base_pfn + cma->count)
 		return false;
 
+#ifdef CONFIG_RHEL_DIFFERENCES
+	pr_warn_once("%s() got called for the first time\n", __func__);
+#endif /* CONFIG_RHEL_DIFFERENCES */
+
 	VM_BUG_ON(pfn + count > cma->base_pfn + cma->count);
 
 	free_contig_range(pfn, count);

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1023
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux