mirror of
https://github.com/torvalds/linux.git
synced 2026-09-12 20:53:03 +02:00
mm/slab: remove objs_per_slab()
The function has an unused kmem_cache argument and almost nothing uses it anyway; doing slab->objects is simpler. Remove it with the last two users. KUNIT_EXPECT_EQ() needs a cast to avoid "error: ‘typeof’ applied to a bit-field" but we don't need to keep a wrapper just for that. Reviewed-by: Suren Baghdasaryan <surenb@google.com> Reviewed-by: Harry Yoo (Oracle) <harry@kernel.org> Reviewed-by: Hao Li <hao.li@linux.dev> Link: https://patch.msgid.link/20260727-b4-objext_split-v3-2-c29ef0f1f257@kernel.org Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
This commit is contained in:
parent
3a11935cd3
commit
a867ffa398
|
|
@ -295,7 +295,7 @@ static void *test_alloc(struct kunit *test, size_t size, gfp_t gfp, enum allocat
|
|||
* memcg accounting works correctly.
|
||||
*/
|
||||
KUNIT_EXPECT_EQ(test, obj_to_index(s, slab, alloc), 0U);
|
||||
KUNIT_EXPECT_EQ(test, objs_per_slab(s, slab), 1);
|
||||
KUNIT_EXPECT_EQ(test, ((unsigned int)slab->objects), 1);
|
||||
|
||||
if (policy == ALLOCATE_ANY)
|
||||
return alloc;
|
||||
|
|
|
|||
|
|
@ -330,12 +330,6 @@ static inline unsigned int obj_to_index(const struct kmem_cache *cache,
|
|||
return __obj_to_index(cache, slab_address(slab), obj);
|
||||
}
|
||||
|
||||
static inline int objs_per_slab(const struct kmem_cache *cache,
|
||||
const struct slab *slab)
|
||||
{
|
||||
return slab->objects;
|
||||
}
|
||||
|
||||
/*
|
||||
* State of the slab allocator.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2130,7 +2130,6 @@ int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s,
|
|||
gfp_t gfp, unsigned int alloc_flags)
|
||||
{
|
||||
const bool allow_spin = alloc_flags_allow_spinning(alloc_flags);
|
||||
unsigned int objects = objs_per_slab(s, slab);
|
||||
bool new_slab = alloc_flags & SLAB_ALLOC_NEW_SLAB;
|
||||
unsigned long new_exts;
|
||||
unsigned long old_exts;
|
||||
|
|
@ -2186,7 +2185,7 @@ int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s,
|
|||
#endif
|
||||
retry:
|
||||
old_exts = READ_ONCE(slab->obj_exts);
|
||||
handle_failed_objexts_alloc(old_exts, vec, objects);
|
||||
handle_failed_objexts_alloc(old_exts, vec, slab->objects);
|
||||
|
||||
if (new_slab) {
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user