On Fri, Nov 13, 2015 at 11:57:40AM +0100, Jesper Dangaard Brouer wrote: > The call slab_pre_alloc_hook() interacts with kmemgc and is not > allowed to be called several times inside the bulk alloc for loop, > due to the call to memcg_kmem_get_cache(). > > This would result in hitting the VM_BUG_ON in __memcg_kmem_get_cache. > > As suggested by Vladimir Davydov, change slab_post_alloc_hook() > to be able to handle an array of objects. > > A subtle detail is, loop iterator "i" in slab_post_alloc_hook() > must have same type (size_t) as size argument. This helps the > compiler to easier realize that it can remove the loop, when all > debug statements inside loop evaluates to nothing. > Note, this is only an issue because the kernel is compiled with > GCC option: -fno-strict-overflow > > In slab_alloc_node() the compiler inlines and optimizes the invocation > of slab_post_alloc_hook(s, flags, 1, &object) by removing the loop and > access object directly. > > Reported-by: Vladimir Davydov <vdavydov@xxxxxxxxxxxxx> > Suggested-by: Vladimir Davydov <vdavydov@xxxxxxxxxxxxx> > Signed-off-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx> Reviewed-by: Vladimir Davydov <vdavydov@xxxxxxxxxxxxx> Thanks! -- 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>