diff options
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/kmemcheck.h> | 21 | #include <linux/kmemcheck.h> |
22 | #include <linux/cpu.h> | 22 | #include <linux/cpu.h> |
23 | #include <linux/cpuset.h> | 23 | #include <linux/cpuset.h> |
24 | #include <linux/kmemleak.h> | ||
25 | #include <linux/mempolicy.h> | 24 | #include <linux/mempolicy.h> |
26 | #include <linux/ctype.h> | 25 | #include <linux/ctype.h> |
27 | #include <linux/debugobjects.h> | 26 | #include <linux/debugobjects.h> |
@@ -2595,6 +2594,8 @@ static inline int kmem_cache_close(struct kmem_cache *s) | |||
2595 | */ | 2594 | */ |
2596 | void kmem_cache_destroy(struct kmem_cache *s) | 2595 | void kmem_cache_destroy(struct kmem_cache *s) |
2597 | { | 2596 | { |
2597 | if (s->flags & SLAB_DESTROY_BY_RCU) | ||
2598 | rcu_barrier(); | ||
2598 | down_write(&slub_lock); | 2599 | down_write(&slub_lock); |
2599 | s->refcount--; | 2600 | s->refcount--; |
2600 | if (!s->refcount) { | 2601 | if (!s->refcount) { |
@@ -2833,13 +2834,15 @@ EXPORT_SYMBOL(__kmalloc); | |||
2833 | static void *kmalloc_large_node(size_t size, gfp_t flags, int node) | 2834 | static void *kmalloc_large_node(size_t size, gfp_t flags, int node) |
2834 | { | 2835 | { |
2835 | struct page *page; | 2836 | struct page *page; |
2837 | void *ptr = NULL; | ||
2836 | 2838 | ||
2837 | flags |= __GFP_COMP | __GFP_NOTRACK; | 2839 | flags |= __GFP_COMP | __GFP_NOTRACK; |
2838 | page = alloc_pages_node(node, flags, get_order(size)); | 2840 | page = alloc_pages_node(node, flags, get_order(size)); |
2839 | if (page) | 2841 | if (page) |
2840 | return page_address(page); | 2842 | ptr = page_address(page); |
2841 | else | 2843 | |
2842 | return NULL; | 2844 | kmemleak_alloc(ptr, size, 1, flags); |
2845 | return ptr; | ||
2843 | } | 2846 | } |
2844 | 2847 | ||
2845 | #ifdef CONFIG_NUMA | 2848 | #ifdef CONFIG_NUMA |
@@ -2924,6 +2927,7 @@ void kfree(const void *x) | |||
2924 | page = virt_to_head_page(x); | 2927 | page = virt_to_head_page(x); |
2925 | if (unlikely(!PageSlab(page))) { | 2928 | if (unlikely(!PageSlab(page))) { |
2926 | BUG_ON(!PageCompound(page)); | 2929 | BUG_ON(!PageCompound(page)); |
2930 | kmemleak_free(x); | ||
2927 | put_page(page); | 2931 | put_page(page); |
2928 | return; | 2932 | return; |
2929 | } | 2933 | } |