Skip to content

Commit 32c894c

Browse files
committed
slab: remove struct kmem_cache_cpu
The cpu slab is not used anymore for allocation or freeing, the remaining code is for flushing, but it's effectively dead. Remove the whole struct kmem_cache_cpu, the flushing code and other orphaned functions. The remaining used field of kmem_cache_cpu is the stat array with CONFIG_SLUB_STATS. Put it instead in a new struct kmem_cache_stats. In struct kmem_cache, the field is cpu_stats and placed near the end of the struct. Reviewed-by: Hao Li <hao.li@linux.dev> Reviewed-by: Suren Baghdasaryan <surenb@google.com> Reviewed-by: Harry Yoo <harry.yoo@oracle.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
1 parent 073d5f1 commit 32c894c

2 files changed

Lines changed: 27 additions & 284 deletions

File tree

mm/slab.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@
2121
# define system_has_freelist_aba() system_has_cmpxchg128()
2222
# define try_cmpxchg_freelist try_cmpxchg128
2323
# endif
24-
#define this_cpu_try_cmpxchg_freelist this_cpu_try_cmpxchg128
2524
typedef u128 freelist_full_t;
2625
#else /* CONFIG_64BIT */
2726
# ifdef system_has_cmpxchg64
2827
# define system_has_freelist_aba() system_has_cmpxchg64()
2928
# define try_cmpxchg_freelist try_cmpxchg64
3029
# endif
31-
#define this_cpu_try_cmpxchg_freelist this_cpu_try_cmpxchg64
3230
typedef u64 freelist_full_t;
3331
#endif /* CONFIG_64BIT */
3432

@@ -189,7 +187,6 @@ struct kmem_cache_order_objects {
189187
* Slab cache management.
190188
*/
191189
struct kmem_cache {
192-
struct kmem_cache_cpu __percpu *cpu_slab;
193190
struct slub_percpu_sheaves __percpu *cpu_sheaves;
194191
/* Used for retrieving partial slabs, etc. */
195192
slab_flags_t flags;
@@ -238,6 +235,10 @@ struct kmem_cache {
238235
unsigned int usersize; /* Usercopy region size */
239236
#endif
240237

238+
#ifdef CONFIG_SLUB_STATS
239+
struct kmem_cache_stats __percpu *cpu_stats;
240+
#endif
241+
241242
struct kmem_cache_node *node[MAX_NUMNODES];
242243
};
243244

0 commit comments

Comments
 (0)