Re: [RFC 1/2] lib/vsprintf: Add support for pte_t

From: David Hildenbrand
Date: Wed Jun 18 2025 - 04:45:36 EST


On 18.06.25 10:37, Anshuman Khandual wrote:


On 18/06/25 1:48 PM, David Hildenbrand wrote:
On 18.06.25 06:12, Anshuman Khandual wrote:
Add a new format for printing page table entries.

Cc: Petr Mladek <pmladek@xxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Jonathan Corbet <corbet@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>
Cc: linux-doc@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: linux-mm@xxxxxxxxx
Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
---
  Documentation/core-api/printk-formats.rst | 14 ++++++++++++++
  lib/vsprintf.c                            | 20 ++++++++++++++++++++
  mm/memory.c                               |  5 ++---
  scripts/checkpatch.pl                     |  2 +-
  4 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index 4b7f3646ec6ce..75a110b059ee1 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -689,6 +689,20 @@ Rust
  Only intended to be used from Rust code to format ``core::fmt::Arguments``.
  Do *not* use it from C.
  +Page Table Entry
+----------------
+
+::
+        %ppte
+
+Print standard page table entry pte_t.
+
+Passed by reference.

Curious, why the decision to pass by reference?

Just to make this via %p<> based address mechanism. But wondering
will it be better for the pte to be represented via value instead
of reference ?

We commonly pass ptes to functions through value, not reference, that's why I am asking.

--
Cheers,

David / dhildenb