]> www.infradead.org Git - users/willy/linux.git/commitdiff
mm/slub: Convert count_partial() to struct slab
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 1 Oct 2021 19:10:36 +0000 (15:10 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 4 Oct 2021 13:17:58 +0000 (09:17 -0400)
Convert all its helper functions at the same time.  Adds a little
typesafety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
mm/slub.c

index 5e10a9cc6939230a9bc7916d3b90e5c87d60d6c1..fc1a7f7832c0498e164a0a622af1ffc660903657 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2730,9 +2730,9 @@ static inline int node_match(struct page *page, int node)
 }
 
 #ifdef CONFIG_SLUB_DEBUG
-static int count_free(struct page *page)
+static int count_free(struct slab *slab)
 {
-       return page->objects - page->inuse;
+       return slab->objects - slab->inuse;
 }
 
 static inline unsigned long node_nr_objs(struct kmem_cache_node *n)
@@ -2743,15 +2743,15 @@ static inline unsigned long node_nr_objs(struct kmem_cache_node *n)
 
 #if defined(CONFIG_SLUB_DEBUG) || defined(CONFIG_SYSFS)
 static unsigned long count_partial(struct kmem_cache_node *n,
-                                       int (*get_count)(struct page *))
+                                       int (*get_count)(struct slab *))
 {
        unsigned long flags;
        unsigned long x = 0;
-       struct page *page;
+       struct slab *slab;
 
        spin_lock_irqsave(&n->list_lock, flags);
-       list_for_each_entry(page, &n->partial, slab_list)
-               x += get_count(page);
+       list_for_each_entry(slab, &n->partial, slab_list)
+               x += get_count(slab);
        spin_unlock_irqrestore(&n->list_lock, flags);
        return x;
 }
@@ -4944,14 +4944,14 @@ EXPORT_SYMBOL(__kmalloc_node_track_caller);
 #endif
 
 #ifdef CONFIG_SYSFS
-static int count_inuse(struct page *page)
+static int count_inuse(struct slab *slab)
 {
-       return page->inuse;
+       return slab->inuse;
 }
 
-static int count_total(struct page *page)
+static int count_total(struct slab *slab)
 {
-       return page->objects;
+       return slab->objects;
 }
 #endif