Since kfree() now supports freeing objects allocated with
kmalloc_nolock(), free one bit in enum object_flags.

Signed-off-by: Harry Yoo <[email protected]>
---
 include/linux/memcontrol.h |  3 +--
 mm/slub.c                  | 12 ++----------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 0651865a4564..bb789ec4a2a2 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -359,8 +359,7 @@ enum objext_flags {
         * MEMCG_DATA_OBJEXTS.
         */
        OBJEXTS_ALLOC_FAIL = __OBJEXTS_ALLOC_FAIL,
-       /* slabobj_ext vector allocated with kmalloc_nolock() */
-       OBJEXTS_NOSPIN_ALLOC = __FIRST_OBJEXT_FLAG,
+       __OBJEXTS_FLAG_UNUSED = __FIRST_OBJEXT_FLAG,
        /* the next bit after the last actual flag */
        __NR_OBJEXTS_FLAGS  = (__FIRST_OBJEXT_FLAG << 1),
 };
diff --git a/mm/slub.c b/mm/slub.c
index a118ac009b61..ac7bc7e1163f 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2186,8 +2186,6 @@ int alloc_slab_obj_exts(struct slab *slab, struct 
kmem_cache *s,
                        virt_to_slab(vec)->slab_cache == s);
 
        new_exts = (unsigned long)vec;
-       if (unlikely(!allow_spin))
-               new_exts |= OBJEXTS_NOSPIN_ALLOC;
 #ifdef CONFIG_MEMCG
        new_exts |= MEMCG_DATA_OBJEXTS;
 #endif
@@ -2210,10 +2208,7 @@ int alloc_slab_obj_exts(struct slab *slab, struct 
kmem_cache *s,
                 * objcg vector should be reused.
                 */
                mark_objexts_empty(vec);
-               if (unlikely(!allow_spin))
-                       kfree_nolock(vec);
-               else
-                       kfree(vec);
+               kfree(vec);
                return 0;
        } else if (cmpxchg(&slab->obj_exts, old_exts, new_exts) != old_exts) {
                /* Retry if a racing thread changed slab->obj_exts from under 
us. */
@@ -2253,10 +2248,7 @@ static inline void free_slab_obj_exts(struct slab *slab)
         * the extension for obj_exts is expected to be NULL.
         */
        mark_objexts_empty(obj_exts);
-       if (unlikely(READ_ONCE(slab->obj_exts) & OBJEXTS_NOSPIN_ALLOC))
-               kfree_nolock(obj_exts);
-       else
-               kfree(obj_exts);
+       kfree(obj_exts);
        slab->obj_exts = 0;
 }
 
-- 
2.43.0


Reply via email to