Commit 33dd4e0e authored by Ian Campbell's avatar Ian Campbell Committed by Linus Torvalds
Browse files

mm: make some struct page's const

These uses are read-only and in a subsequent patch I have a const struct
page in my hand...

[ fix warnings in lowmem_page_address()]
Signed-off-by: default avatarIan Campbell <>
Cc: Rik van Riel <>
Cc: Andrea Arcangeli <>
Cc: Mel Gorman <>
Cc: Michel Lespinasse <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent ee8f248d
......@@ -637,7 +637,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
static inline enum zone_type page_zonenum(struct page *page)
static inline enum zone_type page_zonenum(const struct page *page)
return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
......@@ -665,15 +665,15 @@ static inline int zone_to_nid(struct zone *zone)
extern int page_to_nid(struct page *page);
extern int page_to_nid(const struct page *page);
static inline int page_to_nid(struct page *page)
static inline int page_to_nid(const struct page *page)
return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
static inline struct zone *page_zone(struct page *page)
static inline struct zone *page_zone(const struct page *page)
return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
......@@ -718,9 +718,9 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
#include <linux/vmstat.h>
static __always_inline void *lowmem_page_address(struct page *page)
static __always_inline void *lowmem_page_address(const struct page *page)
return __va(PFN_PHYS(page_to_pfn(page)));
return __va(PFN_PHYS(page_to_pfn((struct page *)page)));
#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
......@@ -40,7 +40,7 @@ static u8 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned;
static u16 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned;
int page_to_nid(struct page *page)
int page_to_nid(const struct page *page)
return section_to_node_table[page_to_section(page)];
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment