diff options
author | Hyeonggon Yoo <42.hyeyoo@gmail.com> | 2022-06-15 00:26:34 +0900 |
---|---|---|
committer | Vlastimil Babka <vbabka@suse.cz> | 2022-07-20 13:30:11 +0200 |
commit | 2055e67bb6a8fbb6aabdb9536443688ef52456c4 (patch) | |
tree | 20c6a80d52916a6cc5f60eab90afa173511d4b45 /mm/slub.c | |
parent | b77d5b1b83e3e14870224de7c63f115a2dc44e9a (diff) | |
download | lwn-2055e67bb6a8fbb6aabdb9536443688ef52456c4.tar.gz lwn-2055e67bb6a8fbb6aabdb9536443688ef52456c4.zip |
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>
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/slub.c b/mm/slub.c index 26b00951aad1..862dbd9af4f5 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -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); |