summaryrefslogtreecommitdiff
path: root/mm/internal.h
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2024-03-26 20:10:28 +0300
committerAndrew Morton <akpm@linux-foundation.org>2024-04-26 06:56:14 +0300
commitb84fd2835c70e0149e2522fd746d3fb7049a1e19 (patch)
treec871a7024d1cea7c88edfbc994bd691d1e6646d5 /mm/internal.h
parent2ace5a670e2a0f3a6029bc6cf91dc14202074e7a (diff)
downloadlinux-b84fd2835c70e0149e2522fd746d3fb7049a1e19.tar.xz
mm: make page_mapped() take a const argument
None of the functions called by page_mapped() modify the page or folio, so mark them all as const. Link: https://lkml.kernel.org/r/20240326171045.410737-7-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/internal.h')
-rw-r--r--mm/internal.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/mm/internal.h b/mm/internal.h
index 5dbfa1c12e89..8e11f7b2da21 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -71,7 +71,7 @@ void page_writeback_init(void);
* How many individual pages have an elevated _mapcount. Excludes
* the folio's entire_mapcount.
*/
-static inline int folio_nr_pages_mapped(struct folio *folio)
+static inline int folio_nr_pages_mapped(const struct folio *folio)
{
return atomic_read(&folio->_nr_pages_mapped) & FOLIO_PAGES_MAPPED;
}
@@ -81,7 +81,8 @@ static inline int folio_nr_pages_mapped(struct folio *folio)
* folio. We cannot rely on folio->swap as there is no guarantee that it has
* been initialized. Used for calling arch_swap_restore()
*/
-static inline swp_entry_t folio_swap(swp_entry_t entry, struct folio *folio)
+static inline swp_entry_t folio_swap(swp_entry_t entry,
+ const struct folio *folio)
{
swp_entry_t swap = {
.val = ALIGN_DOWN(entry.val, folio_nr_pages(folio)),
@@ -90,7 +91,7 @@ static inline swp_entry_t folio_swap(swp_entry_t entry, struct folio *folio)
return swap;
}
-static inline void *folio_raw_mapping(struct folio *folio)
+static inline void *folio_raw_mapping(const struct folio *folio)
{
unsigned long mapping = (unsigned long)folio->mapping;