]> www.infradead.org Git - users/willy/linux.git/commitdiff
mm/slub: Convert get_freelist() to take a struct slab
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 1 Oct 2021 19:42:58 +0000 (15:42 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 4 Oct 2021 13:17:59 +0000 (09:17 -0400)
Adds a little bit of type safety.  Convert the one caller.

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

index fd04aa96602c0e54c64388116081312034c69227..827196f0aee5ee08bb4db0c680ac5f160b8468fb 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2816,32 +2816,32 @@ static inline bool pfmemalloc_match_unsafe(struct page *page, gfp_t gfpflags)
 }
 
 /*
- * Check the page->freelist of a page and either transfer the freelist to the
- * per cpu freelist or deactivate the page.
+ * Check the freelist of a slab and either transfer the freelist to the
+ * per cpu freelist or deactivate the slab
  *
- * The page is still frozen if the return value is not NULL.
+ * The slab is still frozen if the return value is not NULL.
  *
- * If this function returns NULL then the page has been unfrozen.
+ * If this function returns NULL then the slab has been unfrozen.
  */
-static inline void *get_freelist(struct kmem_cache *s, struct page *page)
+static inline void *get_freelist(struct kmem_cache *s, struct slab *slab)
 {
-       struct page new;
+       struct slab new;
        unsigned long counters;
        void *freelist;
 
        lockdep_assert_held(this_cpu_ptr(&s->cpu_slab->lock));
 
        do {
-               freelist = page->freelist;
-               counters = page->counters;
+               freelist = slab->freelist;
+               counters = slab->counters;
 
                new.counters = counters;
                VM_BUG_ON(!new.frozen);
 
-               new.inuse = page->objects;
+               new.inuse = slab->objects;
                new.frozen = freelist != NULL;
 
-       } while (!__cmpxchg_double_slab(s, page,
+       } while (!__cmpxchg_double_slab(s, slab_page(slab),
                freelist, counters,
                NULL, new.counters,
                "get_freelist"));
@@ -2924,7 +2924,7 @@ redo:
        if (freelist)
                goto load_freelist;
 
-       freelist = get_freelist(s, slab_page(slab));
+       freelist = get_freelist(s, slab);
 
        if (!freelist) {
                c->slab = NULL;