diff mbox series

[3/5] mm: Remove casting away of constness

Message ID 20200408150148.25290-4-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Improve page poisoning implementation | expand

Commit Message

Matthew Wilcox April 8, 2020, 3:01 p.m. UTC
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Now that dump_page can take a const struct page pointer, we can get rid
of the cast in page_to_nid().
---
 include/linux/mm.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Pasha Tatashin April 8, 2020, 3:23 p.m. UTC | #1
On Wed, Apr 8, 2020 at 11:01 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
>
> Now that dump_page can take a const struct page pointer, we can get rid
> of the cast in page_to_nid().

Missing Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> ?

Reviewed-by: Pavel Tatashin <pasha.tatashin@soleen.com>
Kirill A . Shutemov April 9, 2020, 2:19 p.m. UTC | #2
On Wed, Apr 08, 2020 at 08:01:46AM -0700, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> 
> Now that dump_page can take a const struct page pointer, we can get rid
		    ^ ()
> of the cast in page_to_nid().

It took me a minute to understand how page_to_nid() related to
dump_page(). Please elaborate in the commit message.

Otherwise, looks good.

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
diff mbox series

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 933450bdcfd4..047144b894bd 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1246,9 +1246,7 @@  extern int page_to_nid(const struct page *page);
 #else
 static inline int page_to_nid(const struct page *page)
 {
-	struct page *p = (struct page *)page;
-
-	return (page_poison_check(p)->flags >> NODES_PGSHIFT) & NODES_MASK;
+	return (page_poison_check(page)->flags >> NODES_PGSHIFT) & NODES_MASK;
 }
 #endif