diff mbox series

[v2,6/6] mm: Print hashed address of struct page

Message ID 20200709202117.7216-7-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Improvements for dump_page() | expand

Commit Message

Matthew Wilcox July 9, 2020, 8:21 p.m. UTC
The actual address of the struct page isn't particularly helpful,
while the hashed address helps match with other messages elsewhere.
Add the PFN that the page refers to in order to help diagnose problems
where the page is improperly aligned for the purpose.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/debug.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

John Hubbard July 11, 2020, 1:48 a.m. UTC | #1
On 2020-07-09 13:21, Matthew Wilcox (Oracle) wrote:
> The actual address of the struct page isn't particularly helpful,
> while the hashed address helps match with other messages elsewhere.
> Add the PFN that the page refers to in order to help diagnose problems
> where the page is improperly aligned for the purpose.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   mm/debug.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/debug.c b/mm/debug.c
> index 60347d0d7609..033f04ffc398 100644
> --- a/mm/debug.c
> +++ b/mm/debug.c
> @@ -89,17 +89,17 @@ void __dump_page(struct page *page, const char *reason)
>   	 */
>   	mapcount = PageSlab(head) ? 0 : page_mapcount(page);
>   
> -	pr_warn("page:%px refcount:%d mapcount:%d mapping:%p index:%#lx\n",
> +	pr_warn("page:%p refcount:%d mapcount:%d mapping:%p index:%#lx pfn:%#lx\n",
>   			page, page_ref_count(head), mapcount, mapping,
> -			page_to_pgoff(page));
> +			page_to_pgoff(page), page_to_pfn(page));
>   	if (compound) {
>   		if (hpage_pincount_available(page)) {
> -			pr_warn("head:%px order:%u compound_mapcount:%d compound_pincount:%d\n",
> +			pr_warn("head:%p order:%u compound_mapcount:%d compound_pincount:%d\n",
>   					head, compound_order(head),
>   					compound_mapcount(head),
>   					compound_pincount(head));
>   		} else {
> -			pr_warn("head:%px order:%u compound_mapcount:%d\n",
> +			pr_warn("head:%p order:%u compound_mapcount:%d\n",
>   					head, compound_order(head),
>   					compound_mapcount(head));
>   		}
> 

Seems reasonable. The first output line is getting long again, but it's still
OK-ish.

     Reviewed-by: John Hubbard <jhubbard@nvidia.com>


thanks,
diff mbox series

Patch

diff --git a/mm/debug.c b/mm/debug.c
index 60347d0d7609..033f04ffc398 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -89,17 +89,17 @@  void __dump_page(struct page *page, const char *reason)
 	 */
 	mapcount = PageSlab(head) ? 0 : page_mapcount(page);
 
-	pr_warn("page:%px refcount:%d mapcount:%d mapping:%p index:%#lx\n",
+	pr_warn("page:%p refcount:%d mapcount:%d mapping:%p index:%#lx pfn:%#lx\n",
 			page, page_ref_count(head), mapcount, mapping,
-			page_to_pgoff(page));
+			page_to_pgoff(page), page_to_pfn(page));
 	if (compound) {
 		if (hpage_pincount_available(page)) {
-			pr_warn("head:%px order:%u compound_mapcount:%d compound_pincount:%d\n",
+			pr_warn("head:%p order:%u compound_mapcount:%d compound_pincount:%d\n",
 					head, compound_order(head),
 					compound_mapcount(head),
 					compound_pincount(head));
 		} else {
-			pr_warn("head:%px order:%u compound_mapcount:%d\n",
+			pr_warn("head:%p order:%u compound_mapcount:%d\n",
 					head, compound_order(head),
 					compound_mapcount(head));
 		}