From 35e3c36d438e05fcd4f846c76cf22cbda9b63abb Mon Sep 17 00:00:00 2001 From: Gou Hao Date: Sun, 18 Dec 2022 20:31:27 +0800 Subject: mm/slab: remove unused slab_early_init 'slab_early_init' was introduced by 'commit e0a42726794f ("[PATCH] mm/slab.c: fix early init assumption")', this flag was used to prevent off-slab caches being created so early during bootup. The only user of 'slab_early_init' was removed in 'commit 3217fd9bdf00 ("mm/slab: make criteria for off slab determination robust and simple")'. Signed-off-by: Gou Hao Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Acked-by: David Rientjes Signed-off-by: Vlastimil Babka --- mm/slab.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'mm/slab.c') diff --git a/mm/slab.c b/mm/slab.c index 7a269db050ee..ede1f29fd81c 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -220,7 +220,6 @@ static inline void fixup_objfreelist_debug(struct kmem_cache *cachep, static inline void fixup_slab_list(struct kmem_cache *cachep, struct kmem_cache_node *n, struct slab *slab, void **list); -static int slab_early_init = 1; #define INDEX_NODE kmalloc_index(sizeof(struct kmem_cache_node)) @@ -1249,8 +1248,6 @@ void __init kmem_cache_init(void) slab_state = PARTIAL_NODE; setup_kmalloc_cache_index_table(); - slab_early_init = 0; - /* 5) Replace the bootstrap kmem_cache_node */ { int nid; -- cgit From c034c6a45c977fdf33de5974d7def75bda9dcadc Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Tue, 10 Jan 2023 00:51:24 +0000 Subject: 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 Signed-off-by: SeongJae Park Reviewed-by: David Hildenbrand Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka --- mm/slab.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mm/slab.c') diff --git a/mm/slab.c b/mm/slab.c index ede1f29fd81c..c7a50fed4c9b 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1386,7 +1386,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct slab *slab) BUG_ON(!folio_test_slab(folio)); __slab_clear_pfmemalloc(slab); - page_mapcount_reset(folio_page(folio, 0)); + page_mapcount_reset(&folio->page); folio->mapping = NULL; /* Make the mapping reset visible before clearing the flag */ smp_wmb(); @@ -1395,7 +1395,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct slab *slab) if (current->reclaim_state) current->reclaim_state->reclaimed_slab += 1 << order; unaccount_slab(slab, order, cachep); - __free_pages(folio_page(folio, 0), order); + __free_pages(&folio->page, order); } static void kmem_rcu_free(struct rcu_head *head) -- cgit From 81ce2ebd194cf32027854ce1c703b7fd129c86b8 Mon Sep 17 00:00:00 2001 From: lvqian Date: Wed, 11 Jan 2023 17:27:44 +0800 Subject: mm/slab.c: cleanup is_debug_pagealloc_cache() Remove the if statement to increase code readability. Also make the function inline, per David. Signed-off-by: lvqian Acked-by: David Rientjes Signed-off-by: Vlastimil Babka --- mm/slab.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'mm/slab.c') diff --git a/mm/slab.c b/mm/slab.c index c7a50fed4c9b..616140e702aa 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1410,13 +1410,10 @@ static void kmem_rcu_free(struct rcu_head *head) } #if DEBUG -static bool is_debug_pagealloc_cache(struct kmem_cache *cachep) +static inline bool is_debug_pagealloc_cache(struct kmem_cache *cachep) { - if (debug_pagealloc_enabled_static() && OFF_SLAB(cachep) && - (cachep->size % PAGE_SIZE) == 0) - return true; - - return false; + return debug_pagealloc_enabled_static() && OFF_SLAB(cachep) && + ((cachep->size % PAGE_SIZE) == 0); } #ifdef CONFIG_DEBUG_PAGEALLOC -- cgit