From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-mm@kvack.org
Subject: [PATCH 2/6] mm: Constify page_address_in_vma()
Date: Tue, 23 Jul 2024 16:34:57 +0100 [thread overview]
Message-ID: <20240723153503.1669586-3-willy@infradead.org> (raw)
In-Reply-To: <20240723153503.1669586-1-willy@infradead.org>
If we also mark the struct folio argument to folio_anon_vma(),
we can make page_address_in_vma() take a const struct page pointer.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/rmap.h | 2 +-
mm/internal.h | 2 +-
mm/rmap.c | 5 +++--
mm/util.c | 2 +-
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 0978c64f49d8..d1fca5b76039 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -732,7 +732,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw);
/*
* Used by swapoff to help locate where page is expected in vma.
*/
-unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
+unsigned long page_address_in_vma(const struct page *, struct vm_area_struct *);
/*
* Cleans the PTEs of shared mappings.
diff --git a/mm/internal.h b/mm/internal.h
index b4d86436565b..e511708b2be0 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -810,7 +810,7 @@ static inline bool is_data_mapping(vm_flags_t flags)
}
/* mm/util.c */
-struct anon_vma *folio_anon_vma(struct folio *folio);
+struct anon_vma *folio_anon_vma(const struct folio *folio);
#ifdef CONFIG_MMU
void unmap_mapping_folio(struct folio *folio);
diff --git a/mm/rmap.c b/mm/rmap.c
index 8616308610b9..886bf67ba382 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -771,9 +771,10 @@ static bool should_defer_flush(struct mm_struct *mm, enum ttu_flags flags)
* At what user virtual address is page expected in vma?
* Caller should check the page is actually part of the vma.
*/
-unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
+unsigned long page_address_in_vma(const struct page *page,
+ struct vm_area_struct *vma)
{
- struct folio *folio = page_folio(page);
+ const struct folio *folio = page_folio(page);
pgoff_t pgoff;
if (folio_test_anon(folio)) {
diff --git a/mm/util.c b/mm/util.c
index bc488f0121a7..8afe3b90d650 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -780,7 +780,7 @@ void *vcalloc_noprof(size_t n, size_t size)
}
EXPORT_SYMBOL(vcalloc_noprof);
-struct anon_vma *folio_anon_vma(struct folio *folio)
+struct anon_vma *folio_anon_vma(const struct folio *folio)
{
unsigned long mapping = (unsigned long)folio->mapping;
--
2.43.0
next prev parent reply other threads:[~2024-07-23 15:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 15:34 [PATCH 0/6] page->index removals in mm Matthew Wilcox (Oracle)
2024-07-23 15:34 ` [PATCH 1/6] bootmem: Stop using page->index Matthew Wilcox (Oracle)
2024-07-23 15:34 ` Matthew Wilcox (Oracle) [this message]
2024-07-24 5:54 ` [PATCH 2/6] mm: Constify page_address_in_vma() kernel test robot
2024-07-24 7:24 ` kernel test robot
2024-07-23 15:34 ` [PATCH 3/6] mm: Convert page_to_pgoff() to page_pgoff() Matthew Wilcox (Oracle)
2024-07-24 7:24 ` kernel test robot
2024-07-23 15:34 ` [PATCH 4/6] mm: Mass constification of folio/page pointers Matthew Wilcox (Oracle)
2024-07-23 15:35 ` [PATCH 5/6] mm: Remove references to page->index in huge_memory.c Matthew Wilcox (Oracle)
2024-07-23 15:35 ` [PATCH 6/6] mm: Use page->private instead of page->index in percpu Matthew Wilcox (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240723153503.1669586-3-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox