[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1509281008480.30332@east.gentwo.org>
Date: Mon, 28 Sep 2015 10:11:09 -0500 (CDT)
From: Christoph Lameter <cl@...ux.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>
cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
netdev@...r.kernel.org,
Alexander Duyck <alexander.duyck@...il.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>
Subject: Re: [PATCH 4/7] slab: implement bulking for SLAB allocator
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 <cl@...ux.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists