Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
[firefly-linux-kernel-4.4.55.git] / mm / slab.c
index 273a5ac2ade3ea8a49becfd0734f18feaa81d840..2580db062df97488a92beeb1e008d866db4d7f7e 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -565,7 +565,7 @@ static void init_node_lock_keys(int q)
        if (slab_state < UP)
                return;
 
-       for (i = 1; i < PAGE_SHIFT + MAX_ORDER; i++) {
+       for (i = 1; i <= KMALLOC_SHIFT_HIGH; i++) {
                struct kmem_cache_node *n;
                struct kmem_cache *cache = kmalloc_caches[i];
 
@@ -714,7 +714,7 @@ static void __slab_error(const char *function, struct kmem_cache *cachep,
        printk(KERN_ERR "slab error in %s(): cache `%s': %s\n",
               function, cachep->name, msg);
        dump_stack();
-       add_taint(TAINT_BAD_PAGE);
+       add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
 }
 #endif
 
@@ -787,7 +787,7 @@ static void next_reap_node(void)
  * the CPUs getting into lockstep and contending for the global cache chain
  * lock.
  */
-static void __cpuinit start_cpu_timer(int cpu)
+static void start_cpu_timer(int cpu)
 {
        struct delayed_work *reap_work = &per_cpu(slab_reap_work, cpu);
 
@@ -1180,7 +1180,13 @@ static int init_cache_node_node(int node)
        return 0;
 }
 
-static void __cpuinit cpuup_canceled(long cpu)
+static inline int slabs_tofree(struct kmem_cache *cachep,
+                                               struct kmem_cache_node *n)
+{
+       return (n->free_objects + cachep->num - 1) / cachep->num;
+}
+
+static void cpuup_canceled(long cpu)
 {
        struct kmem_cache *cachep;
        struct kmem_cache_node *n = NULL;
@@ -1241,11 +1247,11 @@ free_array_cache:
                n = cachep->node[node];
                if (!n)
                        continue;
-               drain_freelist(cachep, n, n->free_objects);
+               drain_freelist(cachep, n, slabs_tofree(cachep, n));
        }
 }
 
-static int __cpuinit cpuup_prepare(long cpu)
+static int cpuup_prepare(long cpu)
 {
        struct kmem_cache *cachep;
        struct kmem_cache_node *n = NULL;
@@ -1328,7 +1334,7 @@ bad:
        return -ENOMEM;
 }
 
-static int __cpuinit cpuup_callback(struct notifier_block *nfb,
+static int cpuup_callback(struct notifier_block *nfb,
                                    unsigned long action, void *hcpu)
 {
        long cpu = (long)hcpu;
@@ -1384,7 +1390,7 @@ static int __cpuinit cpuup_callback(struct notifier_block *nfb,
        return notifier_from_errno(err);
 }
 
-static struct notifier_block __cpuinitdata cpucache_notifier = {
+static struct notifier_block cpucache_notifier = {
        &cpuup_callback, NULL, 0
 };
 
@@ -1408,7 +1414,7 @@ static int __meminit drain_cache_node_node(int node)
                if (!n)
                        continue;
 
-               drain_freelist(cachep, n, n->free_objects);
+               drain_freelist(cachep, n, slabs_tofree(cachep, n));
 
                if (!list_empty(&n->slabs_full) ||
                    !list_empty(&n->slabs_partial)) {
@@ -1917,11 +1923,9 @@ static void print_objinfo(struct kmem_cache *cachep, void *objp, int lines)
        }
 
        if (cachep->flags & SLAB_STORE_USER) {
-               printk(KERN_ERR "Last user: [<%p>]",
-                       *dbg_userword(cachep, objp));
-               print_symbol("(%s)",
-                               (unsigned long)*dbg_userword(cachep, objp));
-               printk("\n");
+               printk(KERN_ERR "Last user: [<%p>](%pSR)\n",
+                      *dbg_userword(cachep, objp),
+                      *dbg_userword(cachep, objp));
        }
        realobj = (char *)objp + obj_offset(cachep);
        size = cachep->object_size;
@@ -2534,7 +2538,7 @@ static int __cache_shrink(struct kmem_cache *cachep)
                if (!n)
                        continue;
 
-               drain_freelist(cachep, n, n->free_objects);
+               drain_freelist(cachep, n, slabs_tofree(cachep, n));
 
                ret += !list_empty(&n->slabs_full) ||
                        !list_empty(&n->slabs_partial);
@@ -4432,20 +4436,10 @@ static int leaks_show(struct seq_file *m, void *p)
        return 0;
 }
 
-static void *s_next(struct seq_file *m, void *p, loff_t *pos)
-{
-       return seq_list_next(p, &slab_caches, pos);
-}
-
-static void s_stop(struct seq_file *m, void *p)
-{
-       mutex_unlock(&slab_mutex);
-}
-
 static const struct seq_operations slabstats_op = {
        .start = leaks_start,
-       .next = s_next,
-       .stop = s_stop,
+       .next = slab_next,
+       .stop = slab_stop,
        .show = leaks_show,
 };