On Thu, 09 May 2019 16:28:58 +0100 David Howells <dhowells@xxxxxxxxxx> wrote: > Is it possible to use kmem_cache_alloc_bulk() with kmalloc slabs to > effect a bulk kmalloc? Well, we have kfree_bulk() which is a simple wrapper around kmem_cache_free_bulk() (as Christoph make me handle that case). We/I didn't code the kmalloc_bulk() variant. What is you use case? (p.s. fixed the MM-email address) -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer static __always_inline void kfree_bulk(size_t size, void **p) { kmem_cache_free_bulk(NULL, size, p); } Handling code for kfree_bulk case: page = virt_to_head_page(object); if (!s) { /* Handle kalloc'ed objects */ if (unlikely(!PageSlab(page))) { BUG_ON(!PageCompound(page)); kfree_hook(object); __free_pages(page, compound_order(page)); p[size] = NULL; /* mark object processed */ return size; } /* Derive kmem_cache from object */ df->s = page->slab_cache; } else { df->s = cache_from_obj(s, object); /* Support for memcg */ }