]> www.infradead.org Git - users/willy/linux.git/commitdiff
mm/slub: Convert pfmemalloc_match() to take a struct slab
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 2 Oct 2021 03:21:25 +0000 (23:21 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 4 Oct 2021 13:18:01 +0000 (09:18 -0400)
Improves type safety and removes calls to slab_page().

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

index 24111e30c7a240b4b6ce0a1e3c4598fc46c3c07d..7e2c5342196a52d35ec946661942891259dfbca9 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2083,7 +2083,7 @@ static void put_cpu_partial(struct kmem_cache *s, struct slab *slab, int drain);
 static inline void put_cpu_partial(struct kmem_cache *s, struct slab *slab,
                                   int drain) { }
 #endif
-static inline bool pfmemalloc_match(struct page *page, gfp_t gfpflags);
+static inline bool pfmemalloc_match(struct slab *slab, gfp_t gfpflags);
 
 /*
  * Try to allocate a partial slab from a specific node.
@@ -2110,7 +2110,7 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n,
        list_for_each_entry_safe(slab, slab2, &n->partial, slab_list) {
                void *t;
 
-               if (!pfmemalloc_match(slab_page(slab), gfpflags))
+               if (!pfmemalloc_match(slab, gfpflags))
                        continue;
 
                t = acquire_slab(s, n, slab, object == NULL, &objects);
@@ -2788,9 +2788,9 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
 #endif
 }
 
-static inline bool pfmemalloc_match(struct page *page, gfp_t gfpflags)
+static inline bool pfmemalloc_match(struct slab *slab, gfp_t gfpflags)
 {
-       if (unlikely(PageSlabPfmemalloc(page)))
+       if (unlikely(slab_test_pfmemalloc(slab)))
                return gfp_pfmemalloc_allowed(gfpflags);
 
        return true;
@@ -3017,7 +3017,7 @@ check_new_slab:
                }
        }
 
-       if (unlikely(!pfmemalloc_match(slab_page(slab), gfpflags)))
+       if (unlikely(!pfmemalloc_match(slab, gfpflags)))
                /*
                 * For !pfmemalloc_match() case we don't load freelist so that
                 * we don't make further mismatched allocations easier.