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 6/7] mm: Remove references to page->index in huge_memory.c
Date: Sat, 5 Oct 2024 21:01:17 +0100 [thread overview]
Message-ID: <20241005200121.3231142-7-willy@infradead.org> (raw)
In-Reply-To: <20241005200121.3231142-1-willy@infradead.org>
We already have folios in all these places; it's just a matter of
using them instead of the pages.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
mm/huge_memory.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 3ca89e0279a7..812287dd6221 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3135,8 +3135,8 @@ static void __split_huge_page_tail(struct folio *folio, int tail,
/* ->mapping in first and second tail page is replaced by other uses */
VM_BUG_ON_PAGE(tail > 2 && page_tail->mapping != TAIL_MAPPING,
page_tail);
- page_tail->mapping = head->mapping;
- page_tail->index = head->index + tail;
+ new_folio->mapping = folio->mapping;
+ new_folio->index = folio->index + tail;
/*
* page->private should not be set in tail pages. Fix up and warn once
@@ -3212,11 +3212,11 @@ static void __split_huge_page(struct page *page, struct list_head *list,
ClearPageHasHWPoisoned(head);
for (i = nr - new_nr; i >= new_nr; i -= new_nr) {
+ struct folio *tail;
__split_huge_page_tail(folio, i, lruvec, list, new_order);
+ tail = page_folio(head + i);
/* Some pages can be beyond EOF: drop them from page cache */
- if (head[i].index >= end) {
- struct folio *tail = page_folio(head + i);
-
+ if (tail->index >= end) {
if (shmem_mapping(folio->mapping))
nr_dropped++;
else if (folio_test_clear_dirty(tail))
@@ -3224,12 +3224,12 @@ static void __split_huge_page(struct page *page, struct list_head *list,
inode_to_wb(folio->mapping->host));
__filemap_remove_folio(tail, NULL);
folio_put(tail);
- } else if (!PageAnon(page)) {
- __xa_store(&folio->mapping->i_pages, head[i].index,
- head + i, 0);
+ } else if (!folio_test_anon(folio)) {
+ __xa_store(&folio->mapping->i_pages, tail->index,
+ tail, 0);
} else if (swap_cache) {
__xa_store(&swap_cache->i_pages, offset + i,
- head + i, 0);
+ tail, 0);
}
}
--
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 ` [PATCH v2 2/7] mm: Use page_pgoff() in more places Matthew Wilcox (Oracle)
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 ` Matthew Wilcox (Oracle) [this message]
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-7-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).