diff options
Diffstat (limited to 'include/linux/slab_def.h')
| -rw-r--r-- | include/linux/slab_def.h | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 5ac9b0bcaf9a..850d057500de 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
| @@ -14,7 +14,88 @@ | |||
| 14 | #include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ | 14 | #include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ |
| 15 | #include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ | 15 | #include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ |
| 16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
| 17 | #include <trace/kmemtrace.h> | 17 | #include <linux/kmemtrace.h> |
| 18 | |||
| 19 | /* | ||
| 20 | * struct kmem_cache | ||
| 21 | * | ||
| 22 | * manages a cache. | ||
| 23 | */ | ||
| 24 | |||
| 25 | struct kmem_cache { | ||
| 26 | /* 1) per-cpu data, touched during every alloc/free */ | ||
| 27 | struct array_cache *array[NR_CPUS]; | ||
| 28 | /* 2) Cache tunables. Protected by cache_chain_mutex */ | ||
| 29 | unsigned int batchcount; | ||
| 30 | unsigned int limit; | ||
| 31 | unsigned int shared; | ||
| 32 | |||
| 33 | unsigned int buffer_size; | ||
| 34 | u32 reciprocal_buffer_size; | ||
| 35 | /* 3) touched by every alloc & free from the backend */ | ||
| 36 | |||
| 37 | unsigned int flags; /* constant flags */ | ||
| 38 | unsigned int num; /* # of objs per slab */ | ||
| 39 | |||
| 40 | /* 4) cache_grow/shrink */ | ||
| 41 | /* order of pgs per slab (2^n) */ | ||
| 42 | unsigned int gfporder; | ||
| 43 | |||
| 44 | /* force GFP flags, e.g. GFP_DMA */ | ||
| 45 | gfp_t gfpflags; | ||
| 46 | |||
| 47 | size_t colour; /* cache colouring range */ | ||
| 48 | unsigned int colour_off; /* colour offset */ | ||
| 49 | struct kmem_cache *slabp_cache; | ||
| 50 | unsigned int slab_size; | ||
| 51 | unsigned int dflags; /* dynamic flags */ | ||
| 52 | |||
| 53 | /* constructor func */ | ||
| 54 | void (*ctor)(void *obj); | ||
| 55 | |||
| 56 | /* 5) cache creation/removal */ | ||
| 57 | const char *name; | ||
| 58 | struct list_head next; | ||
| 59 | |||
| 60 | /* 6) statistics */ | ||
| 61 | #ifdef CONFIG_DEBUG_SLAB | ||
| 62 | unsigned long num_active; | ||
| 63 | unsigned long num_allocations; | ||
| 64 | unsigned long high_mark; | ||
| 65 | unsigned long grown; | ||
| 66 | unsigned long reaped; | ||
| 67 | unsigned long errors; | ||
| 68 | unsigned long max_freeable; | ||
| 69 | unsigned long node_allocs; | ||
| 70 | unsigned long node_frees; | ||
| 71 | unsigned long node_overflow; | ||
| 72 | atomic_t allochit; | ||
| 73 | atomic_t allocmiss; | ||
| 74 | atomic_t freehit; | ||
| 75 | atomic_t freemiss; | ||
| 76 | |||
| 77 | /* | ||
| 78 | * If debugging is enabled, then the allocator can add additional | ||
| 79 | * fields and/or padding to every object. buffer_size contains the total | ||
| 80 | * object size including these internal fields, the following two | ||
| 81 | * variables contain the offset to the user object and its size. | ||
| 82 | */ | ||
| 83 | int obj_offset; | ||
| 84 | int obj_size; | ||
| 85 | #endif /* CONFIG_DEBUG_SLAB */ | ||
| 86 | |||
| 87 | /* | ||
| 88 | * We put nodelists[] at the end of kmem_cache, because we want to size | ||
| 89 | * this array to nr_node_ids slots instead of MAX_NUMNODES | ||
| 90 | * (see kmem_cache_init()) | ||
| 91 | * We still use [MAX_NUMNODES] and not [1] or [0] because cache_cache | ||
| 92 | * is statically defined, so we reserve the max number of nodes. | ||
| 93 | */ | ||
| 94 | struct kmem_list3 *nodelists[MAX_NUMNODES]; | ||
| 95 | /* | ||
| 96 | * Do not add fields after nodelists[] | ||
| 97 | */ | ||
| 98 | }; | ||
| 18 | 99 | ||
| 19 | /* Size description struct for general caches. */ | 100 | /* Size description struct for general caches. */ |
| 20 | struct cache_sizes { | 101 | struct cache_sizes { |
