Re: [PATCH V4 1/2] slub: fix kmem cgroup bug in kmem_cache_alloc_bulk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]