Skip to content

Commit c034c6a

Browse files
sjp38tehcaster
authored andcommitted
mm/sl{a,u}b: fix wrong usages of folio_page() for getting head pages
The standard idiom for getting head page of a given folio is '&folio->page', but some are wrongly using 'folio_page(folio, 0)' for the purpose. Fix those to use the idiom. Suggested-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: SeongJae Park <sj@kernel.org> Reviewed-by: David Hildenbrand <david@redhat.com> Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
1 parent 35e3c36 commit c034c6a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mm/slab.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct slab *slab)
13861386

13871387
BUG_ON(!folio_test_slab(folio));
13881388
__slab_clear_pfmemalloc(slab);
1389-
page_mapcount_reset(folio_page(folio, 0));
1389+
page_mapcount_reset(&folio->page);
13901390
folio->mapping = NULL;
13911391
/* Make the mapping reset visible before clearing the flag */
13921392
smp_wmb();
@@ -1395,7 +1395,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct slab *slab)
13951395
if (current->reclaim_state)
13961396
current->reclaim_state->reclaimed_slab += 1 << order;
13971397
unaccount_slab(slab, order, cachep);
1398-
__free_pages(folio_page(folio, 0), order);
1398+
__free_pages(&folio->page, order);
13991399
}
14001400

14011401
static void kmem_rcu_free(struct rcu_head *head)

mm/slub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ static void __free_slab(struct kmem_cache *s, struct slab *slab)
20662066
if (current->reclaim_state)
20672067
current->reclaim_state->reclaimed_slab += pages;
20682068
unaccount_slab(slab, order, s);
2069-
__free_pages(folio_page(folio, 0), order);
2069+
__free_pages(&folio->page, order);
20702070
}
20712071

20722072
static void rcu_free_slab(struct rcu_head *h)

0 commit comments

Comments
 (0)