On Mon, 2 Jun 2014, Joonsoo Kim wrote: > Meanwhile, I think that this change is not good for readability. There > are many for_each_online_node() usage that we can't replace, so I don't We can replace many of them if we do not pass "node" around but a pointer to the node structure. Like here: Subject: slab: Use for_each_kmem_cache_work by reworking call chain fopr slab_set_lock_classes Signed-off-by: Christoph Lameter <cl@xxxxxxxxx> Index: linux/mm/slab.c =================================================================== --- linux.orig/mm/slab.c 2014-06-02 10:50:26.631319986 -0500 +++ linux/mm/slab.c 2014-06-02 12:34:15.279952487 -0500 @@ -455,16 +455,11 @@ static struct lock_class_key debugobj_al static void slab_set_lock_classes(struct kmem_cache *cachep, struct lock_class_key *l3_key, struct lock_class_key *alc_key, - int q) + struct kmem_cache_node *n) { struct array_cache **alc; - struct kmem_cache_node *n; int r; - n = get_node(cachep, q); - if (!n) - return; - lockdep_set_class(&n->list_lock, l3_key); alc = n->alien; /* @@ -482,17 +477,19 @@ static void slab_set_lock_classes(struct } } -static void slab_set_debugobj_lock_classes_node(struct kmem_cache *cachep, int node) +static void slab_set_debugobj_lock_classes_node(struct kmem_cache *cachep, + struct kmem_cache_node *ne) { - slab_set_lock_classes(cachep, &debugobj_l3_key, &debugobj_alc_key, node); + slab_set_lock_classes(cachep, &debugobj_l3_key, &debugobj_alc_key, n); } static void slab_set_debugobj_lock_classes(struct kmem_cache *cachep) { int node; + struct kmem_cache_node *n; - for_each_online_node(node) - slab_set_debugobj_lock_classes_node(cachep, node); + for_each_kmem_cache_node(cachep, node, h) + slab_set_debugobj_lock_classes_node(cachep, n); } static void init_node_lock_keys(int q) -- 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>