Skip to content

Commit 33dd4e0

Browse files
Ian Campbelltorvalds
authored andcommitted
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... [akpm@linux-foundation.org: fix warnings in lowmem_page_address()] Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Cc: Rik van Riel <riel@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Michel Lespinasse <walken@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ee8f248 commit 33dd4e0

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎include/linux/mm.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
637637
#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
638638
#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
639639

640-
static inline enum zone_type page_zonenum(struct page *page)
640+
static inline enum zone_type page_zonenum(const struct page *page)
641641
{
642642
return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
643643
}
@@ -665,15 +665,15 @@ static inline int zone_to_nid(struct zone *zone)
665665
}
666666

667667
#ifdef NODE_NOT_IN_PAGE_FLAGS
668-
extern int page_to_nid(struct page *page);
668+
extern int page_to_nid(const struct page *page);
669669
#else
670-
static inline int page_to_nid(struct page *page)
670+
static inline int page_to_nid(const struct page *page)
671671
{
672672
return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
673673
}
674674
#endif
675675

676-
static inline struct zone *page_zone(struct page *page)
676+
static inline struct zone *page_zone(const struct page *page)
677677
{
678678
return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
679679
}
@@ -718,9 +718,9 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
718718
*/
719719
#include <linux/vmstat.h>
720720

721-
static __always_inline void *lowmem_page_address(struct page *page)
721+
static __always_inline void *lowmem_page_address(const struct page *page)
722722
{
723-
return __va(PFN_PHYS(page_to_pfn(page)));
723+
return __va(PFN_PHYS(page_to_pfn((struct page *)page)));
724724
}
725725

726726
#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)

‎mm/sparse.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static u8 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned;
4040
static u16 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned;
4141
#endif
4242

43-
int page_to_nid(struct page *page)
43+
int page_to_nid(const struct page *page)
4444
{
4545
return section_to_node_table[page_to_section(page)];
4646
}

0 commit comments

Comments
 (0)