On 10/19/2012 06:25 PM, Christoph Lameter wrote: > The nodelists field in kmem_cache is pointing to the first unused > object in the array field when bootstrap is complete. > > A problem with the current approach is that the statically sized > kmem_cache structure use on boot can only contain NR_CPUS entries. > If the number of nodes plus the number of cpus is greater then we > would overwrite memory following the kmem_cache_boot definition. > > Increase the size of the array field to ensure that also the node > pointers fit into the array field. > > Once we do that we no longer need the kmem_cache_nodelists > array and we can then also use that structure elsewhere. Fair. One comment: > /* > + * The memory after the last cpu cache pointer is used for the > + * the nodelists pointer. > + */ > +static void setup_nodelists_pointer(struct kmem_cache *s) > +{ > + s->nodelists = (struct kmem_list3 **)&s->array[nr_cpu_ids]; > +} > + > +/* > * Initialisation. Called after the page allocator have been initialised and > * before smp_init(). > */ > @@ -1590,13 +1597,15 @@ void __init kmem_cache_init(void) > int node; > > kmem_cache = &kmem_cache_boot; > + setup_nodelists_pointer(kmem_cache); > > if (num_possible_nodes() == 1) > use_alien_caches = 0; > > + > for (i = 0; i < NUM_INIT_LISTS; i++) { > kmem_list3_init(&initkmem_list3[i]); > - if (i < MAX_NUMNODES) > + if (i < nr_node_ids) > kmem_cache->nodelists[i] = NULL; > } With nodelists being part of kmem_cache, and kmem_cache being allocated with kmem_cache_zalloc, it seems to me that you can actually just get rid of the inner loop instead of patching it. But this is orthogonal to this patch... So: Acked-by: Glauber Costa <glommer@xxxxxxxxxxxxx> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>