]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - mm/slob.c
mm: remove all rcu head initializations
[linux-2.6.git] / mm / slob.c
index 494f05f19417a438496e8e5e5defd43b9d668e88..19d2e5d46724824864055612ddcda295f9871d4c 100644 (file)
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -46,7 +46,7 @@
  * NUMA support in SLOB is fairly simplistic, pushing most of the real
  * logic down to the page allocator, and simply doing the node accounting
  * on the upper levels. In the event that a node id is explicitly
- * provided, alloc_pages_node() with the specified node id is used
+ * provided, alloc_pages_exact_node() with the specified node id is used
  * instead. The common case (or when the node id isn't explicitly provided)
  * will default to the current node, as per numa_node_id().
  *
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
+#include <linux/swap.h> /* struct reclaim_state */
 #include <linux/cache.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/rcupdate.h>
 #include <linux/list.h>
 #include <linux/kmemtrace.h>
+#include <linux/kmemleak.h>
 #include <asm/atomic.h>
 
 /*
@@ -131,17 +133,17 @@ static LIST_HEAD(free_slob_large);
  */
 static inline int is_slob_page(struct slob_page *sp)
 {
-       return PageSlobPage((struct page *)sp);
+       return PageSlab((struct page *)sp);
 }
 
 static inline void set_slob_page(struct slob_page *sp)
 {
-       __SetPageSlobPage((struct page *)sp);
+       __SetPageSlab((struct page *)sp);
 }
 
 static inline void clear_slob_page(struct slob_page *sp)
 {
-       __ClearPageSlobPage((struct page *)sp);
+       __ClearPageSlab((struct page *)sp);
 }
 
 static inline struct slob_page *slob_page(const void *addr)
@@ -242,7 +244,7 @@ static void *slob_new_pages(gfp_t gfp, int order, int node)
 
 #ifdef CONFIG_NUMA
        if (node != -1)
-               page = alloc_pages_node(node, gfp, order);
+               page = alloc_pages_exact_node(node, gfp, order);
        else
 #endif
                page = alloc_pages(gfp, order);
@@ -255,6 +257,8 @@ static void *slob_new_pages(gfp_t gfp, int order, int node)
 
 static void slob_free_pages(void *b, int order)
 {
+       if (current->reclaim_state)
+               current->reclaim_state->reclaimed_slab += 1 << order;
        free_pages((unsigned long)b, order);
 }
 
@@ -407,7 +411,7 @@ static void slob_free(void *block, int size)
                spin_unlock_irqrestore(&slob_lock, flags);
                clear_slob_page(sp);
                free_slob_page(sp);
-               free_page((unsigned long)b);
+               slob_free_pages(b, 0);
                return;
        }
 
@@ -463,14 +467,6 @@ out:
  * End of slob allocator proper. Begin kmem_cache_alloc and kmalloc frontend.
  */
 
-#ifndef ARCH_KMALLOC_MINALIGN
-#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
-#endif
-
-#ifndef ARCH_SLAB_MINALIGN
-#define ARCH_SLAB_MINALIGN __alignof__(unsigned long)
-#endif
-
 void *__kmalloc_node(size_t size, gfp_t gfp, int node)
 {
        unsigned int *m;
@@ -506,6 +502,7 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
                                   size, PAGE_SIZE << order, gfp, node);
        }
 
+       kmemleak_alloc(ret, size, 1, gfp);
        return ret;
 }
 EXPORT_SYMBOL(__kmalloc_node);
@@ -518,6 +515,7 @@ void kfree(const void *block)
 
        if (unlikely(ZERO_OR_NULL_PTR(block)))
                return;
+       kmemleak_free(block);
 
        sp = slob_page(block);
        if (is_slob_page(sp)) {
@@ -581,12 +579,16 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
        } else if (flags & SLAB_PANIC)
                panic("Cannot create slab cache %s\n", name);
 
+       kmemleak_alloc(c, sizeof(struct kmem_cache), 1, GFP_KERNEL);
        return c;
 }
 EXPORT_SYMBOL(kmem_cache_create);
 
 void kmem_cache_destroy(struct kmem_cache *c)
 {
+       kmemleak_free(c);
+       if (c->flags & SLAB_DESTROY_BY_RCU)
+               rcu_barrier();
        slob_free(c, sizeof(struct kmem_cache));
 }
 EXPORT_SYMBOL(kmem_cache_destroy);
@@ -610,6 +612,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
        if (c->ctor)
                c->ctor(b);
 
+       kmemleak_alloc_recursive(b, c->size, 1, c->flags, flags);
        return b;
 }
 EXPORT_SYMBOL(kmem_cache_alloc_node);
@@ -632,10 +635,10 @@ static void kmem_rcu_free(struct rcu_head *head)
 
 void kmem_cache_free(struct kmem_cache *c, void *b)
 {
+       kmemleak_free_recursive(b, c->flags);
        if (unlikely(c->flags & SLAB_DESTROY_BY_RCU)) {
                struct slob_rcu *slob_rcu;
                slob_rcu = b + (c->size - sizeof(struct slob_rcu));
-               INIT_RCU_HEAD(&slob_rcu->head);
                slob_rcu->size = c->size;
                call_rcu(&slob_rcu->head, kmem_rcu_free);
        } else {
@@ -680,3 +683,8 @@ void __init kmem_cache_init(void)
 {
        slob_ready = 1;
 }
+
+void __init kmem_cache_init_late(void)
+{
+       /* Nothing to do */
+}