linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Xiaobing Luo <luoxiaobing0926@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Xiaobing Luo <luoxiaobing0926@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm/cma: change print format of pointer in pr_debug() With %p, the pointer will be hashed and print (____ptrval____) instead.
Date: Wed, 27 Dec 2023 06:18:25 +0000	[thread overview]
Message-ID: <20231227061825.116177-1-luoxiaobing0926@gmail.com> (raw)

 [    0.070467] cma: cma_alloc(cma (____ptrval____), count 256, align 8)
 [    0.073003] cma: cma_alloc(): returned (____ptrval____)

Use 0x%px instead of %p to print the pointer. Then the print will be like:

 [    0.054963] cma: cma_alloc(cma 0xffffffde9ad42a60, count 256, align 8)
 [    0.057385] cma: cma_alloc(): returned 0xfffffffe003b0000

Signed-off-by: Xiaobing Luo <luoxiaobing0926@gmail.com>
---
 mm/cma.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/cma.c b/mm/cma.c
index 2b2494fd6b59..4559f903df8f 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -440,7 +440,7 @@ struct page *cma_alloc(struct cma *cma, unsigned long count,
 	if (!cma || !cma->count || !cma->bitmap)
 		goto out;
 
-	pr_debug("%s(cma %p, name: %s, count %lu, align %d)\n", __func__,
+	pr_debug("%s(cma 0x%px, name: %s, count %lu, align %d)\n", __func__,
 		(void *)cma, cma->name, count, align);
 
 	if (!count)
@@ -487,7 +487,7 @@ struct page *cma_alloc(struct cma *cma, unsigned long count,
 		if (ret != -EBUSY)
 			break;
 
-		pr_debug("%s(): memory range at pfn 0x%lx %p is busy, retrying\n",
+		pr_debug("%s(): memory range at pfn 0x%lx 0x%px is busy, retrying\n",
 			 __func__, pfn, pfn_to_page(pfn));
 
 		trace_cma_alloc_busy_retry(cma->name, pfn, pfn_to_page(pfn),
@@ -514,7 +514,7 @@ struct page *cma_alloc(struct cma *cma, unsigned long count,
 		cma_debug_show_areas(cma);
 	}
 
-	pr_debug("%s(): returned %p\n", __func__, page);
+	pr_debug("%s(): returned 0x%px\n", __func__, page);
 out:
 	if (page) {
 		count_vm_event(CMA_ALLOC_SUCCESS);
@@ -539,7 +539,7 @@ bool cma_pages_valid(struct cma *cma, const struct page *pages,
 	pfn = page_to_pfn(pages);
 
 	if (pfn < cma->base_pfn || pfn >= cma->base_pfn + cma->count) {
-		pr_debug("%s(page %p, count %lu)\n", __func__,
+		pr_debug("%s(page 0x%px, count %lu)\n", __func__,
 						(void *)pages, count);
 		return false;
 	}
@@ -565,7 +565,7 @@ bool cma_release(struct cma *cma, const struct page *pages,
 	if (!cma_pages_valid(cma, pages, count))
 		return false;
 
-	pr_debug("%s(page %p, count %lu)\n", __func__, (void *)pages, count);
+	pr_debug("%s(page 0x%px, count %lu)\n", __func__, (void *)pages, count);
 
 	pfn = page_to_pfn(pages);
 
-- 
2.34.1



             reply	other threads:[~2023-12-27  6:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-27  6:18 Xiaobing Luo [this message]
2023-12-27  9:56 ` Matthew Wilcox

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=20231227061825.116177-1-luoxiaobing0926@gmail.com \
    --to=luoxiaobing0926@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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