]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - mm/slub.c
pinctrl: ingenic: Add lcd-8bit group for JZ4770
[mirror_ubuntu-jammy-kernel.git] / mm / slub.c
index 6d3574013b2f8cf745e9f2ffeab9b819e8b27546..b30be2385d1cdeb80098985fec23d7b8223bd106 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1956,7 +1956,7 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n,
        /*
         * Racy check. If we mistakenly see no partial slabs then we
         * just allocate an empty slab. If we mistakenly try to get a
-        * partial slab and there is none available then get_partials()
+        * partial slab and there is none available then get_partial()
         * will return NULL.
         */
        if (!n || !n->nr_partial)
@@ -2245,7 +2245,8 @@ redo:
                }
        } else {
                m = M_FULL;
-               if (kmem_cache_debug(s) && !lock) {
+#ifdef CONFIG_SLUB_DEBUG
+               if ((s->flags & SLAB_STORE_USER) && !lock) {
                        lock = 1;
                        /*
                         * This also ensures that the scanning of full
@@ -2254,6 +2255,7 @@ redo:
                         */
                        spin_lock(&n->list_lock);
                }
+#endif
        }
 
        if (l != m) {
@@ -2661,6 +2663,8 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
        void *freelist;
        struct page *page;
 
+       stat(s, ALLOC_SLOWPATH);
+
        page = c->page;
        if (!page) {
                /*
@@ -2850,7 +2854,6 @@ redo:
        page = c->page;
        if (unlikely(!object || !node_match(page, node))) {
                object = __slab_alloc(s, gfpflags, node, addr, c);
-               stat(s, ALLOC_SLOWPATH);
        } else {
                void *next_object = get_freepointer_safe(s, object);
 
@@ -3019,20 +3022,21 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
 
        if (likely(!n)) {
 
-               /*
-                * If we just froze the page then put it onto the
-                * per cpu partial list.
-                */
-               if (new.frozen && !was_frozen) {
+               if (likely(was_frozen)) {
+                       /*
+                        * The list lock was not taken therefore no list
+                        * activity can be necessary.
+                        */
+                       stat(s, FREE_FROZEN);
+               } else if (new.frozen) {
+                       /*
+                        * If we just froze the page then put it onto the
+                        * per cpu partial list.
+                        */
                        put_cpu_partial(s, page, 1);
                        stat(s, CPU_PARTIAL_FREE);
                }
-               /*
-                * The list lock was not taken therefore no list
-                * activity can be necessary.
-                */
-               if (was_frozen)
-                       stat(s, FREE_FROZEN);
+
                return;
        }
 
@@ -3091,7 +3095,7 @@ static __always_inline void do_slab_free(struct kmem_cache *s,
        struct kmem_cache_cpu *c;
        unsigned long tid;
 
-       memcg_slab_free_hook(s, page, head);
+       memcg_slab_free_hook(s, &head, 1);
 redo:
        /*
         * Determine the currently cpus per cpu slab.
@@ -3253,6 +3257,7 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p)
        if (WARN_ON(!size))
                return;
 
+       memcg_slab_free_hook(s, p, size);
        do {
                struct detached_freelist df;