Skip to content

Commit 8defffa

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
mm: convert lru_add_page_tail() to lru_add_split_folio()
Remove three hidden calls to compound_head() and accesses to page->lru. Link: https://lkml.kernel.org/r/20250313151458.4145978-1-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent f841ad9 commit 8defffa

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
@@ -3262,25 +3262,25 @@ static void remap_page(struct folio *folio, unsigned long nr, int flags)
32623262
}
32633263
}
32643264

3265-
static void lru_add_page_tail(struct folio *folio, struct page *tail,
3265+
static void lru_add_split_folio(struct folio *folio, struct folio *new_folio,
32663266
struct lruvec *lruvec, struct list_head *list)
32673267
{
3268-
VM_BUG_ON_FOLIO(PageLRU(tail), folio);
3268+
VM_BUG_ON_FOLIO(folio_test_lru(new_folio), folio);
32693269
lockdep_assert_held(&lruvec->lru_lock);
32703270

32713271
if (list) {
32723272
/* page reclaim is reclaiming a huge page */
32733273
VM_WARN_ON(folio_test_lru(folio));
3274-
get_page(tail);
3275-
list_add_tail(&tail->lru, list);
3274+
folio_get(new_folio);
3275+
list_add_tail(&new_folio->lru, list);
32763276
} else {
32773277
/* head is still on lru (and we have it frozen) */
32783278
VM_WARN_ON(!folio_test_lru(folio));
32793279
if (folio_test_unevictable(folio))
3280-
tail->mlock_count = 0;
3280+
new_folio->mlock_count = 0;
32813281
else
3282-
list_add_tail(&tail->lru, &folio->lru);
3283-
SetPageLRU(tail);
3282+
list_add_tail(&new_folio->lru, &folio->lru);
3283+
folio_set_lru(new_folio);
32843284
}
32853285
}
32863286

@@ -3581,8 +3581,8 @@ static int __split_unmapped_folio(struct folio *folio, int new_order,
35813581
((mapping || swap_cache) ?
35823582
folio_nr_pages(release) : 0));
35833583

3584-
lru_add_page_tail(origin_folio, &release->page,
3585-
lruvec, list);
3584+
lru_add_split_folio(origin_folio, release, lruvec,
3585+
list);
35863586

35873587
/* Some pages can be beyond EOF: drop them from cache */
35883588
if (release->index >= end) {

0 commit comments

Comments
 (0)