mm: slub: Add SLUB_SYSFS
Make slub sysfs interface selectable. Save about 4.8ms of boot time on RK1808 EVB if unselected. Change-Id: I2587cc259c3c31a209604d99640d8e84a4ba78f4 Signed-off-by: Tao Huang <huangtao@rock-chips.com>
This commit is contained in:
parent
40094f11cb
commit
d2014f8b68
3 changed files with 15 additions and 10 deletions
|
|
@ -104,7 +104,7 @@ struct kmem_cache {
|
|||
unsigned int red_left_pad; /* Left redzone padding size */
|
||||
const char *name; /* Name (only for display!) */
|
||||
struct list_head list; /* List of slab caches */
|
||||
#ifdef CONFIG_SYSFS
|
||||
#ifdef CONFIG_SLUB_SYSFS
|
||||
struct kobject kobj; /* For sysfs */
|
||||
struct work_struct kobj_remove_work;
|
||||
#endif
|
||||
|
|
@ -112,7 +112,7 @@ struct kmem_cache {
|
|||
struct memcg_cache_params memcg_params;
|
||||
/* for propagation, maximum size of a stored attr */
|
||||
unsigned int max_attr_size;
|
||||
#ifdef CONFIG_SYSFS
|
||||
#ifdef CONFIG_SLUB_SYSFS
|
||||
struct kset *memcg_kset;
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -153,7 +153,7 @@ struct kmem_cache {
|
|||
#define slub_set_cpu_partial(s, n)
|
||||
#endif // CONFIG_SLUB_CPU_PARTIAL
|
||||
|
||||
#ifdef CONFIG_SYSFS
|
||||
#ifdef CONFIG_SLUB_SYSFS
|
||||
#define SLAB_SUPPORTS_SYSFS
|
||||
void sysfs_slab_unlink(struct kmem_cache *);
|
||||
void sysfs_slab_release(struct kmem_cache *);
|
||||
|
|
|
|||
|
|
@ -1667,6 +1667,11 @@ config VM_EVENT_COUNTERS
|
|||
on EXPERT systems. /proc/vmstat will only show page counts
|
||||
if VM event counters are disabled.
|
||||
|
||||
config SLUB_SYSFS
|
||||
bool "Enable SLUB sysfs interface"
|
||||
depends on SLUB && SYSFS
|
||||
default y
|
||||
|
||||
config SLUB_DEBUG
|
||||
default y
|
||||
bool "Enable SLUB debugging support" if EXPERT
|
||||
|
|
|
|||
14
mm/slub.c
14
mm/slub.c
|
|
@ -212,7 +212,7 @@ struct track {
|
|||
|
||||
enum track_item { TRACK_ALLOC, TRACK_FREE };
|
||||
|
||||
#ifdef CONFIG_SYSFS
|
||||
#ifdef CONFIG_SLUB_SYSFS
|
||||
static int sysfs_slab_add(struct kmem_cache *);
|
||||
static int sysfs_slab_alias(struct kmem_cache *, const char *);
|
||||
static void memcg_propagate_slab_attrs(struct kmem_cache *s);
|
||||
|
|
@ -2347,7 +2347,7 @@ static inline unsigned long node_nr_objs(struct kmem_cache_node *n)
|
|||
}
|
||||
#endif /* CONFIG_SLUB_DEBUG */
|
||||
|
||||
#if defined(CONFIG_SLUB_DEBUG) || defined(CONFIG_SYSFS)
|
||||
#if defined(CONFIG_SLUB_DEBUG) || defined(CONFIG_SLUB_SYSFS)
|
||||
static unsigned long count_partial(struct kmem_cache_node *n,
|
||||
int (*get_count)(struct page *))
|
||||
{
|
||||
|
|
@ -2361,7 +2361,7 @@ static unsigned long count_partial(struct kmem_cache_node *n,
|
|||
spin_unlock_irqrestore(&n->list_lock, flags);
|
||||
return x;
|
||||
}
|
||||
#endif /* CONFIG_SLUB_DEBUG || CONFIG_SYSFS */
|
||||
#endif /* CONFIG_SLUB_DEBUG || CONFIG_SLUB_SYSFS */
|
||||
|
||||
static noinline void
|
||||
slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
|
||||
|
|
@ -4329,7 +4329,7 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSFS
|
||||
#ifdef CONFIG_SLUB_SYSFS
|
||||
static int count_inuse(struct page *page)
|
||||
{
|
||||
return page->inuse;
|
||||
|
|
@ -4710,12 +4710,12 @@ static void __init resiliency_test(void)
|
|||
validate_slab_cache(kmalloc_caches[9]);
|
||||
}
|
||||
#else
|
||||
#ifdef CONFIG_SYSFS
|
||||
#ifdef CONFIG_SLUB_SYSFS
|
||||
static void resiliency_test(void) {};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSFS
|
||||
#ifdef CONFIG_SLUB_SYSFS
|
||||
enum slab_stat_type {
|
||||
SL_ALL, /* All slabs */
|
||||
SL_PARTIAL, /* Only partially allocated slabs */
|
||||
|
|
@ -5841,7 +5841,7 @@ static int __init slab_sysfs_init(void)
|
|||
}
|
||||
|
||||
__initcall(slab_sysfs_init);
|
||||
#endif /* CONFIG_SYSFS */
|
||||
#endif /* CONFIG_SLUB_SYSFS */
|
||||
|
||||
/*
|
||||
* The /proc/slabinfo ABI
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue