Move clearing of objects outside IRQ disabled section, to minimize time spend with local IRQs off. Signed-off-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx> --- mm/slub.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index d10de5a33c03..26f64005a347 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2781,13 +2781,18 @@ bool kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, c->freelist = get_freepointer(s, object); p[i] = object; - - if (unlikely(flags & __GFP_ZERO)) - memset(object, 0, s->object_size); } c->tid = next_tid(c->tid); local_irq_enable(); + /* Clear memory outside IRQ disabled fastpath loop */ + if (unlikely(flags & __GFP_ZERO)) { + int j; + + for (j = 0; j < i; j++) + memset(p[j], 0, s->object_size); + } + /* Fallback to single elem alloc */ for (; i < size; i++) { void *x = p[i] = kmem_cache_alloc(s, flags); -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>