Sorry, I am a bit confused by your question. On 10/25/07, Wang Yu <wangyuict@xxxxxxxxx> wrote: > Hi, All > In multiprocessor systems, each cache of the slab allocator includes a > per-CPU data structure consisting of a small array of pointers to freed > objects called the slab local cache. The data structure of this cache is > struct kmem_cache , and the first element in it is struct array_cache > *array[NR_CPUS], that means each CPU has a local cache with type struct > array_cache . Since one cpu may have several caches in its memory and each One cpu several cache? Why do your say that? In general, any global variable, only have one copy in memory, no matter how many CPUs. And this one copy of global variable is to be shared by all CPUs, and so to prevent collision, the ID of the CPU is used as an index into the global array, to stored each specific CPU's data. And in slab.c, these are the possible usage pattern: return cachep->array[smp_processor_id()]; cachep->array[cpu] = nc; nc = cachep->array[cpu]; cachep->array[cpu] = NULL; malloc_sizes[INDEX_AC].cs_cachep->array[smp_processor_id()] = kfree(cachep->array[i]); cachep->array[smp_processor_id()] = &initarray_generic.cache; cachep->array[smp_processor_id()] = new->cachep->array[smp_processor_id()] = new->new[smp_processor_id()]; > cache has pointers to local caches of all CPUs, my question is how to > organize and implement the local cache in each CPU and why each cache must > contain local caches of all CPUs? > Thanks! > Hope I have clarified your doubts. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ