3. Common variable name
• slub.cでよく使われれる変数名
• このスライドでも単にcと書いている場合はstruct kmem_cache_cpuの変数
を指します
• s
• struct kmem_cacheの変数
• c
• struct kmem_cache_cpuの変数
• n
• struct kmem_cache_nodeの変数
12. struct kmem_cache
struct kmem_cache {
struct kmem_cache_cpu __percpu *cpu_slab;
/* Used for retriving partial slabs etc */
unsigned long flags;
unsigned long min_partial;
int size; /* The size of an object including meta data */
int object_size; /* The size of an object without meta data */
int offset; /* Free pointer offset. */
int cpu_partial; /* Number of per cpu partial objects to keep around
*/
struct kmem_cache_order_objects oo;
∼略∼
struct kmem_cache_node *node[MAX_NUMNODES];
};
Slab Objectの管理
に使う主な変数
13. struct kmem_cache_cpu
struct kmem_cache_cpu {
void **freelist; /* Pointer to next available object */
unsigned long tid; /* Globally unique transaction id */
struct page *page; /* The slab from which we are allocating */
struct page *partial; /* Partially allocated frozen slabs */
#ifdef CONFIG_SLUB_STATS
unsigned stat[NR_SLUB_STAT_ITEMS];
#endif
};
28. alloc_kmem_cache_cpus()
• s->cpu_slabオブジェクトの設定
• __alloc_percpu()を使う
• init_kmem_cache_cpu()でslubで使うトランザ
クションIDの設定
/*
* The transaction ids are globally unique per cpu and per operation on
* a per cpu queue. Thus they can be guarantee that the cmpxchg_double
* occurs on the right processor and that there was no operation on the
* linked list in between.
*/