[MIPS] Change libgcc-style functions from lib-y to obj-y
[linux-drm-fsl-dcu.git] / mm / slub.c
index c9ab68881b43ebe8525fb2fa1e943f9810229c21..0437f2f09986beb793b53d22daf5ee6d683eeb57 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1798,8 +1798,6 @@ static struct kmem_cache_node * __init early_kmem_cache_node_alloc(gfp_t gfpflag
        BUG_ON(kmalloc_caches->size < sizeof(struct kmem_cache_node));
 
        page = new_slab(kmalloc_caches, gfpflags | GFP_THISNODE, node);
-       /* new_slab() disables interupts */
-       local_irq_enable();
 
        BUG_ON(!page);
        n = page->freelist;
@@ -1811,6 +1809,12 @@ static struct kmem_cache_node * __init early_kmem_cache_node_alloc(gfp_t gfpflag
        init_kmem_cache_node(n);
        atomic_long_inc(&n->nr_slabs);
        add_partial(n, page);
+
+       /*
+        * new_slab() disables interupts. If we do not reenable interrupts here
+        * then bootup would continue with interrupts disabled.
+        */
+       local_irq_enable();
        return n;
 }
 
@@ -2436,6 +2440,7 @@ EXPORT_SYMBOL(krealloc);
 void __init kmem_cache_init(void)
 {
        int i;
+       int caches = 0;
 
 #ifdef CONFIG_NUMA
        /*
@@ -2446,20 +2451,29 @@ void __init kmem_cache_init(void)
        create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node",
                sizeof(struct kmem_cache_node), GFP_KERNEL);
        kmalloc_caches[0].refcount = -1;
+       caches++;
 #endif
 
        /* Able to allocate the per node structures */
        slab_state = PARTIAL;
 
        /* Caches that are not of the two-to-the-power-of size */
-       create_kmalloc_cache(&kmalloc_caches[1],
+       if (KMALLOC_MIN_SIZE <= 64) {
+               create_kmalloc_cache(&kmalloc_caches[1],
                                "kmalloc-96", 96, GFP_KERNEL);
-       create_kmalloc_cache(&kmalloc_caches[2],
+               caches++;
+       }
+       if (KMALLOC_MIN_SIZE <= 128) {
+               create_kmalloc_cache(&kmalloc_caches[2],
                                "kmalloc-192", 192, GFP_KERNEL);
+               caches++;
+       }
 
-       for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++)
+       for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) {
                create_kmalloc_cache(&kmalloc_caches[i],
                        "kmalloc", 1 << i, GFP_KERNEL);
+               caches++;
+       }
 
        slab_state = UP;
 
@@ -2476,8 +2490,8 @@ void __init kmem_cache_init(void)
                                nr_cpu_ids * sizeof(struct page *);
 
        printk(KERN_INFO "SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d,"
-               " Processors=%d, Nodes=%d\n",
-               KMALLOC_SHIFT_HIGH, cache_line_size(),
+               " CPUs=%d, Nodes=%d\n",
+               caches, cache_line_size(),
                slub_min_order, slub_max_order, slub_min_objects,
                nr_cpu_ids, nr_node_ids);
 }
@@ -2867,7 +2881,7 @@ static int alloc_loc_track(struct loc_track *t, unsigned long max)
 
        order = get_order(sizeof(struct location) * max);
 
-       l = (void *)__get_free_pages(GFP_KERNEL, order);
+       l = (void *)__get_free_pages(GFP_ATOMIC, order);
 
        if (!l)
                return 0;
@@ -3032,13 +3046,15 @@ static int list_locations(struct kmem_cache *s, char *buf,
                        n += sprintf(buf + n, " pid=%ld",
                                l->min_pid);
 
-               if (num_online_cpus() > 1 && !cpus_empty(l->cpus)) {
+               if (num_online_cpus() > 1 && !cpus_empty(l->cpus) &&
+                               n < PAGE_SIZE - 60) {
                        n += sprintf(buf + n, " cpus=");
                        n += cpulist_scnprintf(buf + n, PAGE_SIZE - n - 50,
                                        l->cpus);
                }
 
-               if (num_online_nodes() > 1 && !nodes_empty(l->nodes)) {
+               if (num_online_nodes() > 1 && !nodes_empty(l->nodes) &&
+                               n < PAGE_SIZE - 60) {
                        n += sprintf(buf + n, " nodes=");
                        n += nodelist_scnprintf(buf + n, PAGE_SIZE - n - 50,
                                        l->nodes);