| Message ID | 20260818040041.1891769-2-anshuman.khandual@arm.com |
|---|---|
| State | New |
| Headers | show |
| Series | mm: Drop pxd_ERROR() | expand |
On 8/18/26 06:00, Anshuman Khandual wrote: > Move ptrval_to_str() inside a header thus making the helper more generally > available for new users which are being added later. While here, also move > another related string size macro PTVAL_STR_MAX inside the header as well. > > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: David Hildenbrand <david@kernel.org> > Cc: Lorenzo Stoakes <ljs@kernel.org> > Cc: linux-mm@kvack.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > --- I would have placed that into include/linux/pgtable.h. Any particular reason for mm_types? Acked-by: David Hildenbrand (Arm) <david@kernel.org>
On Tue, Aug 18, 2026 at 07:25:07PM +0200, David Hildenbrand (Arm) wrote: > On 8/18/26 06:00, Anshuman Khandual wrote: > > Move ptrval_to_str() inside a header thus making the helper more generally > > available for new users which are being added later. While here, also move > > another related string size macro PTVAL_STR_MAX inside the header as well. > > > > Cc: Andrew Morton <akpm@linux-foundation.org> > > Cc: David Hildenbrand <david@kernel.org> > > Cc: Lorenzo Stoakes <ljs@kernel.org> > > Cc: linux-mm@kvack.org > > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > > --- > > I would have placed that into include/linux/pgtable.h. Any particular reason for > mm_types? Yes - that works as well. These declaration and macros need to be moved inside #ifndef __ASSEMBLY__ block in include/linux/pgtable.h file. Will do the change as suggested while dropping the RFC tag once v7.3-rc1 is released. > > Acked-by: David Hildenbrand (Arm) <david@kernel.org> > > -- > Cheers, > > David
> Move ptrval_to_str() inside a header thus making the helper more generally > available for new users which are being added later. While here, also move > another related string size macro PTVAL_STR_MAX inside the header as well. > > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: David Hildenbrand <david@kernel.org> > Cc: Lorenzo Stoakes <ljs@kernel.org> > Cc: linux-mm@kvack.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> I agree with David, include/linux/pgtable.h is better. Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
On 2026-08-17 11:00 PM, Anshuman Khandual wrote: > Move ptrval_to_str() inside a header thus making the helper more generally Typo here and in subject: ptrval -> ptval > available for new users which are being added later. While here, also move > another related string size macro PTVAL_STR_MAX inside the header as well. > > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: David Hildenbrand <david@kernel.org> > Cc: Lorenzo Stoakes <ljs@kernel.org> > Cc: linux-mm@kvack.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > --- > include/linux/mm_types.h | 15 +++++++++++++++ > mm/memory.c | 16 ++-------------- > 2 files changed, 17 insertions(+), 14 deletions(-) > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index b18c2b2e7d2c..a5b514e55dd7 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -2001,4 +2001,19 @@ static inline unsigned long mmf_init_legacy_flags(unsigned long flags) > return flags & MMF_INIT_LEGACY_MASK; > } > > +void ptval_bytes_to_hex_str(char *buf, size_t buf_size, const void *entry, size_t entry_size); > + > +#define ptval_to_str(buf, val) \ >...
On Mon, Aug 24, 2026 at 10:45:09AM -0500, Samuel Holland wrote: > On 2026-08-17 11:00 PM, Anshuman Khandual wrote: > > Move ptrval_to_str() inside a header thus making the helper more generally > > Typo here and in subject: ptrval -> ptval Fixed. > > > available for new users which are being added later. While here, also move > > another related string size macro PTVAL_STR_MAX inside the header as well. > > > > Cc: Andrew Morton <akpm@linux-foundation.org> > > Cc: David Hildenbrand <david@kernel.org> > > Cc: Lorenzo Stoakes <ljs@kernel.org> > > Cc: linux-mm@kvack.org > > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > > --- > > include/linux/mm_types.h | 15 +++++++++++++++ > > mm/memory.c | 16 ++-------------- > > 2 files changed, 17 insertions(+), 14 deletions(-) > > > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > > index b18c2b2e7d2c..a5b514e55dd7 100644 > > --- a/include/linux/mm_types.h > > +++ b/include/linux/mm_types.h > > @@ -2001,4 +2001,19 @@ static inline unsigned long mmf_init_legacy_flags(unsigned long flags) > > return flags & MMF_INIT_LEGACY_MASK; > > } > > > > +void ptval_bytes_to_hex_str(char *buf, size_t buf_size, const void *entry, size_t entry_size); > > + > > +#define ptval_to_str(buf, val) \ > >...
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index b18c2b2e7d2c..a5b514e55dd7 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -2001,4 +2001,19 @@ static inline unsigned long mmf_init_legacy_flags(unsigned long flags) return flags & MMF_INIT_LEGACY_MASK; } +void ptval_bytes_to_hex_str(char *buf, size_t buf_size, const void *entry, size_t entry_size); + +#define ptval_to_str(buf, val) \ + do { \ + auto __val = (val); \ + \ + ptval_bytes_to_hex_str((buf), sizeof(buf), &__val, sizeof(__val)); \ + } while (0) + +#if defined(__SIZEOF_INT128__) +#define PTVAL_STR_MAX (32 + 1) /* Max 128-bit value in hex + NUL */ +#else +#define PTVAL_STR_MAX (16 + 1) /* Max 64-bit value in hex + NUL */ +#endif + #endif /* _LINUX_MM_TYPES_H */ diff --git a/mm/memory.c b/mm/memory.c index 01893720b6d8..752fc04ef8ac 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -46,6 +46,7 @@ #include <linux/sched/numa_balancing.h> #include <linux/sched/task.h> #include <linux/hugetlb.h> +#include <linux/mm_types.h> #include <linux/mman.h> #include <linux/swap.h> #include <linux/highmem.h> @@ -519,7 +520,7 @@ static bool is_bad_page_map_ratelimited(void) return false; } -static void ptval_bytes_to_hex_str(char *buf, size_t buf_size, const void *entry, size_t entry_size) +void ptval_bytes_to_hex_str(char *buf, size_t buf_size, const void *entry, size_t entry_size) { if (WARN_ON_ONCE(buf_size < entry_size * 2 + 1)) { snprintf(buf, buf_size, "overflow"); @@ -546,19 +547,6 @@ static void ptval_bytes_to_hex_str(char *buf, size_t buf_size, const void *entry } } -#define ptval_to_str(buf, val) \ - do { \ - auto __val = (val); \ - \ - ptval_bytes_to_hex_str((buf), sizeof(buf), &__val, sizeof(__val)); \ - } while (0) - -#if defined(__SIZEOF_INT128__) -#define PTVAL_STR_MAX (32 + 1) /* Max 128-bit value in hex + NUL */ -#else -#define PTVAL_STR_MAX (16 + 1) /* Max 64-bit value in hex + NUL */ -#endif - static void __print_bad_page_map_pgtable(struct mm_struct *mm, unsigned long addr) { char pgd_str[PTVAL_STR_MAX];
Move ptrval_to_str() inside a header thus making the helper more generally available for new users which are being added later. While here, also move another related string size macro PTVAL_STR_MAX inside the header as well. Cc: Andrew Morton <akpm@linux-foundation.org> Cc: David Hildenbrand <david@kernel.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> --- include/linux/mm_types.h | 15 +++++++++++++++ mm/memory.c | 16 ++-------------- 2 files changed, 17 insertions(+), 14 deletions(-)