Re: [RFC] mm: Drop pxd_ERROR()
From: David Hildenbrand (Arm)
Date: Thu Aug 06 2026 - 07:47:36 EST
On 8/6/26 10:06, Anshuman Khandual wrote:
> pxd_ERROR() has been used in generic mm just to print the page table entry
> in pxd_clear_bad() before clearing those out with pxd_clear() later. These
> pxd_ERROR() macros have been provided by all platforms which basically did
> the same thing.
>
> Make pxd_clear_bad() use recently added ptval_to_str() instead for printing
> page table entries thus completely dropping dependency on platform provided
> pxd_ERROR() macros which can then be dropped off. First move all required
> helpers in core MM into a header file which could then be used else where.
>
> Although some platforms still use those macros internally as well. In which
> case just move these macros inside the platform for now.
No, just get rid of them first.
The ones in arch/sh/mm/init.c are just supid:
if (pgd_none(*pgd)) {
pgd_ERROR(*pgd);
printing a none PGD? Stupid. :)
Then there is arch/parisc/kernel/pci-dma.c, which just open-codes
pmd_clear_bad() ?
pmd_ERROR(*pmd);
pmd_clear(pmd);
Anything else?
>
> Cc: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: linux-arch@xxxxxxxxxxxxxxx
> Cc: linux-mm@xxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> ---
> This applies on v7.2-rc6 but after the following patch
>
> https://lore.kernel.org/all/20260709044334.1741263-1-anshuman.khandual@xxxxxxx/
>
> Would it also make sense to just drop __FILE__ and __LINE__ from the output
> in pxd_clear_bad() helpers as they always print the same details regardless
> the error path and does not add much value.
Yes, drop that, it's nonsensical given that all relevant calls are from
mm/pgtable-generic.c
Thanks for looking into this!
--
Cheers,
David