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 v2 2/7] mm: Use page_pgoff() in more places
Date: Sat, 5 Oct 2024 21:01:13 +0100 [thread overview]
Message-ID: <20241005200121.3231142-3-willy@infradead.org> (raw)
In-Reply-To: <20241005200121.3231142-1-willy@infradead.org>
There are several places which currently open-code page_pgoff(),
convert them to call it.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
kernel/futex/core.c | 2 +-
mm/page_vma_mapped.c | 3 +--
mm/rmap.c | 4 +---
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 136768ae2637..342dc4dd328b 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -399,7 +399,7 @@ int get_futex_key(u32 __user *uaddr, unsigned int flags, union futex_key *key,
key->both.offset |= FUT_OFF_INODE; /* inode-based key */
key->shared.i_seq = get_inode_sequence_number(inode);
- key->shared.pgoff = folio->index + folio_page_idx(folio, page);
+ key->shared.pgoff = page_pgoff(folio, page);
rcu_read_unlock();
}
diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
index ae5cc42aa208..ade3c6833587 100644
--- a/mm/page_vma_mapped.c
+++ b/mm/page_vma_mapped.c
@@ -328,7 +328,6 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
unsigned long page_mapped_in_vma(struct page *page, struct vm_area_struct *vma)
{
struct folio *folio = page_folio(page);
- pgoff_t pgoff = folio->index + folio_page_idx(folio, page);
struct page_vma_mapped_walk pvmw = {
.pfn = page_to_pfn(page),
.nr_pages = 1,
@@ -336,7 +335,7 @@ unsigned long page_mapped_in_vma(struct page *page, struct vm_area_struct *vma)
.flags = PVMW_SYNC,
};
- pvmw.address = vma_address(vma, pgoff, 1);
+ pvmw.address = vma_address(vma, page_pgoff(folio, page), 1);
if (pvmw.address == -EFAULT)
goto out;
if (!page_vma_mapped_walk(&pvmw))
diff --git a/mm/rmap.c b/mm/rmap.c
index 3b11f8b6935d..90df71c640bf 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -775,7 +775,6 @@ static bool should_defer_flush(struct mm_struct *mm, enum ttu_flags flags)
unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
{
struct folio *folio = page_folio(page);
- pgoff_t pgoff;
if (folio_test_anon(folio)) {
struct anon_vma *page__anon_vma = folio_anon_vma(folio);
@@ -793,8 +792,7 @@ unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
}
/* The !page__anon_vma above handles KSM folios */
- pgoff = folio->index + folio_page_idx(folio, page);
- return vma_address(vma, pgoff, 1);
+ return vma_address(vma, page_pgoff(folio, page), 1);
}
/*
--
2.43.0
next prev parent reply other threads:[~2024-10-05 20:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-05 20:01 [PATCH v2 0/7] page->index removals in mm Matthew Wilcox (Oracle)
2024-10-05 20:01 ` [PATCH v2 1/7] mm: Convert page_to_pgoff() to page_pgoff() Matthew Wilcox (Oracle)
2024-10-05 20:01 ` Matthew Wilcox (Oracle) [this message]
2024-10-05 20:01 ` [PATCH v2 3/7] mm: Renovate page_address_in_vma() Matthew Wilcox (Oracle)
2024-10-05 20:01 ` [PATCH v2 4/7] mm: Mass constification of folio/page pointers Matthew Wilcox (Oracle)
2024-10-05 20:01 ` [PATCH v2 5/7] bootmem: Stop using page->index Matthew Wilcox (Oracle)
2024-10-08 18:48 ` kernel test robot
2024-10-08 19:29 ` kernel test robot
2024-10-09 21:34 ` Andrew Morton
2024-10-05 20:01 ` [PATCH v2 6/7] mm: Remove references to page->index in huge_memory.c Matthew Wilcox (Oracle)
2024-10-05 20:01 ` [PATCH v2 7/7] 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=20241005200121.3231142-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;
as well as URLs for NNTP newsgroup(s).