On Mon, 28 Sep 2015, Jesper Dangaard Brouer wrote:

> +/* Note that interrupts must be enabled when calling this function. */
>  bool kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size,
> -                                                             void **p)
> +                        void **p)
>  {
> -     return __kmem_cache_alloc_bulk(s, flags, size, p);
> +     size_t i;
> +
> +     local_irq_disable();
> +     for (i = 0; i < size; i++) {
> +             void *x = p[i] = slab_alloc(s, flags, _RET_IP_, false);
> +
> +             if (!x) {
> +                     __kmem_cache_free_bulk(s, i, p);
> +                     return false;
> +             }
> +     }
> +     local_irq_enable();
> +     return true;
>  }
>  EXPORT_SYMBOL(kmem_cache_alloc_bulk);
>

Ok the above could result in excessive times when the interrupts are
kept off.  Lets say someone is freeing 1000 objects?

> +/* Note that interrupts must be enabled when calling this function. */
> +void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p)
> +{
> +     size_t i;
> +
> +     local_irq_disable();
> +     for (i = 0; i < size; i++)
> +             __kmem_cache_free(s, p[i], false);
> +     local_irq_enable();
> +}
> +EXPORT_SYMBOL(kmem_cache_free_bulk);

Same concern here. We may just have to accept this for now.

Acked-by: Christoph Lameter <c...@linux.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to