mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
mm/sl[au]b: use own bulk free function when bulk alloc failed
There is no benefit to call generic bulk free function when kmem_cache_alloc_bulk() failed. Use own kmem_cache_free_bulk() instead of generic function. Note that if kmem_cache_alloc_bulk() fails to allocate first object in SLUB, size is zero. So allow passing size == 0 to kmem_cache_free_bulk() like SLAB's. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
This commit is contained in:
parent
b77d5b1b83
commit
2055e67bb6
@ -3553,7 +3553,7 @@ error:
|
||||
local_irq_enable();
|
||||
cache_alloc_debugcheck_after_bulk(s, flags, i, p, _RET_IP_);
|
||||
slab_post_alloc_hook(s, objcg, flags, i, p, false);
|
||||
__kmem_cache_free_bulk(s, i, p);
|
||||
kmem_cache_free_bulk(s, i, p);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(kmem_cache_alloc_bulk);
|
||||
|
@ -3647,7 +3647,7 @@ int build_detached_freelist(struct kmem_cache *s, size_t size,
|
||||
/* Note that interrupts must be enabled when calling this function. */
|
||||
void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p)
|
||||
{
|
||||
if (WARN_ON(!size))
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
do {
|
||||
@ -3738,7 +3738,7 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size,
|
||||
error:
|
||||
slub_put_cpu_ptr(s->cpu_slab);
|
||||
slab_post_alloc_hook(s, objcg, flags, i, p, false);
|
||||
__kmem_cache_free_bulk(s, i, p);
|
||||
kmem_cache_free_bulk(s, i, p);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(kmem_cache_alloc_bulk);
|
||||
|
Loading…
Reference in New Issue
Block a user