diff options
-rw-r--r-- | mm/slub.c | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -2757,10 +2757,6 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p) struct page *page; int i; - /* Debugging fallback to generic bulk */ - if (kmem_cache_debug(s)) - return __kmem_cache_free_bulk(s, size, p); - local_irq_disable(); c = this_cpu_ptr(s->cpu_slab); @@ -2768,8 +2764,13 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p) void *object = p[i]; BUG_ON(!object); + /* kmem cache debug support */ + s = cache_from_obj(s, object); + if (unlikely(!s)) + goto exit; + slab_free_hook(s, object); + page = virt_to_head_page(object); - BUG_ON(s != page->slab_cache); /* Check if valid slab page */ if (c->page == page) { /* Fastpath: local CPU free */ @@ -2784,6 +2785,7 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p) c = this_cpu_ptr(s->cpu_slab); } } +exit: c->tid = next_tid(c->tid); local_irq_enable(); } @@ -2796,10 +2798,6 @@ bool kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, struct kmem_cache_cpu *c; int i; - /* Debugging fallback to generic bulk */ - if (kmem_cache_debug(s)) - return __kmem_cache_alloc_bulk(s, flags, size, p); - /* * Drain objects in the per cpu slab, while disabling local * IRQs, which protects against PREEMPT and interrupts @@ -2828,8 +2826,20 @@ bool kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, continue; /* goto for-loop */ } + /* kmem_cache debug support */ + s = slab_pre_alloc_hook(s, flags); + if (unlikely(!s)) { + __kmem_cache_free_bulk(s, i, p); + c->tid = next_tid(c->tid); + local_irq_enable(); + return false; + } + c->freelist = get_freepointer(s, object); p[i] = object; + + /* kmem_cache debug support */ + slab_post_alloc_hook(s, flags, object); } c->tid = next_tid(c->tid); local_irq_enable(); |