Re: [PATCH V3] mm: Standardize printing for pgtable entries

From: Anshuman Khandual

Date: Sun Jul 12 2026 - 22:37:54 EST




On 11/07/26 10:28 AM, Matthew Wilcox wrote:
> On Thu, Jul 09, 2026 at 10:13:34AM +0530, Anshuman Khandual wrote:
>> @@ -532,34 +575,34 @@ static void __print_bad_page_map_pgtable(struct mm_struct *mm, unsigned long add
>> * see locking requirements for print_bad_page_map().
>> */
>> pgdp = pgd_offset(mm, addr);
>> - pgdv = pgd_val(*pgdp);
>> + ptval_to_str(pgd_str, pgd_val(*pgdp));
>>
>> if (!pgd_present(*pgdp) || pgd_leaf(*pgdp)) {
>> - pr_alert("pgd:%08llx\n", pgdv);
>> + pr_alert("pgd:%s\n", pgd_str);
>
> Why can't we do this as:
>
> pr_alert("pgd:%*phN\n", sizeof(pgdv), &pgdv);

%*phN dumps raw memory bytes and will have different formats on little
vs big endian platforms which is not desired here. Debug print here is
expected to report pgtable entry canonical value where various platform
specific fields can be inspected.
>
> It'd save us all this stack space.
>