Skip to content

Commit 544ec0e

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
mm: remove references to page->index in huge_memory.c
We already have folios in all these places; it's just a matter of using them instead of the pages. Link: https://lkml.kernel.org/r/20241005200121.3231142-7-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 0386aaa commit 544ec0e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

mm/huge_memory.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,8 +3199,8 @@ static void __split_huge_page_tail(struct folio *folio, int tail,
31993199
/* ->mapping in first and second tail page is replaced by other uses */
32003200
VM_BUG_ON_PAGE(tail > 2 && page_tail->mapping != TAIL_MAPPING,
32013201
page_tail);
3202-
page_tail->mapping = head->mapping;
3203-
page_tail->index = head->index + tail;
3202+
new_folio->mapping = folio->mapping;
3203+
new_folio->index = folio->index + tail;
32043204

32053205
/*
32063206
* page->private should not be set in tail pages. Fix up and warn once
@@ -3276,24 +3276,24 @@ static void __split_huge_page(struct page *page, struct list_head *list,
32763276
ClearPageHasHWPoisoned(head);
32773277

32783278
for (i = nr - new_nr; i >= new_nr; i -= new_nr) {
3279+
struct folio *tail;
32793280
__split_huge_page_tail(folio, i, lruvec, list, new_order);
3281+
tail = page_folio(head + i);
32803282
/* Some pages can be beyond EOF: drop them from page cache */
3281-
if (head[i].index >= end) {
3282-
struct folio *tail = page_folio(head + i);
3283-
3283+
if (tail->index >= end) {
32843284
if (shmem_mapping(folio->mapping))
32853285
nr_dropped++;
32863286
else if (folio_test_clear_dirty(tail))
32873287
folio_account_cleaned(tail,
32883288
inode_to_wb(folio->mapping->host));
32893289
__filemap_remove_folio(tail, NULL);
32903290
folio_put(tail);
3291-
} else if (!PageAnon(page)) {
3292-
__xa_store(&folio->mapping->i_pages, head[i].index,
3293-
head + i, 0);
3291+
} else if (!folio_test_anon(folio)) {
3292+
__xa_store(&folio->mapping->i_pages, tail->index,
3293+
tail, 0);
32943294
} else if (swap_cache) {
32953295
__xa_store(&swap_cache->i_pages, offset + i,
3296-
head + i, 0);
3296+
tail, 0);
32973297
}
32983298
}
32993299

0 commit comments

Comments
 (0)