mm/slab.c: cleanup is_debug_pagealloc_cache()
authorlvqian <lvqian@nfschina.com>
Wed, 11 Jan 2023 09:27:44 +0000 (17:27 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Fri, 13 Jan 2023 11:19:01 +0000 (12:19 +0100)
Remove the if statement to increase code readability.
Also make the function inline, per David.

Signed-off-by: lvqian <lvqian@nfschina.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slab.c

index c7a50fed4c9b8e2bdb10c10e20f275308238212b..616140e702aad1f71c6e875ea0d568f46e1bf9c5 100644 (file)
--- 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